Mercurial > pidgin
annotate src/gtkconv.c @ 6075:f7ddc1f6227e
[gaim-migrate @ 6534]
This should prevent warnings on some compilers. This change will either
make all warnings go away and have MSN continue to run as normal, or cause
MSN to crash on almost every message. I'm not sure yet. I'll wait for the
bug reports.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Thu, 10 Jul 2003 06:55:23 +0000 |
parents | c99959f1bb73 |
children | 97835d03f0bb |
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" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
35 #include "log.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
36 #include "multi.h" |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5402
diff
changeset
|
37 #include "notify.h" |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
38 #include "prefs.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
39 #include "prpl.h" |
6038 | 40 #include "request.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
41 #include "sound.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
42 #include "util.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
43 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
44 #include "dnd-hints.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
45 #include "gtkblist.h" |
5717 | 46 #include "gtkconv.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
47 #include "gtkimhtml.h" |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
48 #include "gtkpounce.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
49 #include "gtkutils.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
50 #include "stock.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
51 |
5717 | 52 #include "ui.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
53 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
54 /* XXX */ |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
55 #include "gaim.h" |
4359 | 56 |
4373
dcc6c130c6d9
[gaim-migrate @ 4639]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4370
diff
changeset
|
57 #ifdef _WIN32 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
58 # include "wspell.h" |
4373
dcc6c130c6d9
[gaim-migrate @ 4639]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4370
diff
changeset
|
59 #endif |
dcc6c130c6d9
[gaim-migrate @ 4639]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4370
diff
changeset
|
60 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
61 #define AUTO_RESPONSE "<AUTO-REPLY> : " |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
62 |
4359 | 63 static char nick_colors[][8] = { |
64 "#ba55d3", /* Medium Orchid */ | |
65 "#ee82ee", /* Violet */ | |
66 "#c715b4", /* Medium Violet Red */ | |
67 "#ff69b4", /* Hot Pink */ | |
68 "#ff6347", /* Tomato */ | |
69 "#fa8c00", /* Dark Orange */ | |
70 "#fa8072", /* Salmon */ | |
71 "#b22222", /* Fire Brick */ | |
72 "#f4a460", /* Sandy Brown */ | |
73 "#cd5c5c", /* Indian Red */ | |
74 "#bc8f8f", /* Rosy Brown */ | |
75 "#f0e68c", /* Khaki */ | |
76 "#bdb76b", /* Dark Khaki */ | |
77 "#228b22", /* Forest Green */ | |
78 "#9acd32", /* Yellow Green */ | |
79 "#32cd32", /* Lime Green */ | |
80 "#3cb371", /* Medium Sea Green */ | |
81 "#2e8b57", /* Sea Green */ | |
82 "#8fbc8f", /* Dark Sea Green */ | |
83 "#66cdaa", /* Medium Aquamarine */ | |
84 "#5f9ea0", /* Cadet Blue */ | |
85 "#48d1cc", /* Medium Turquoise */ | |
86 "#00ced1", /* Dark Turquoise */ | |
87 "#4682b4", /* Stell Blue */ | |
88 "#00bfff", /* Deep Sky Blue */ | |
89 "#1690ff", /* Dodger Blue */ | |
90 "#4169ff", /* Royal Blue */ | |
91 "#6a5acd", /* Slate Blue */ | |
92 "#6495ed", /* Cornflower Blue */ | |
93 "#708090", /* Slate gray */ | |
94 "#ffdead", /* Navajo White */ | |
95 }; | |
96 #define NUM_NICK_COLORS (sizeof(nick_colors) / sizeof(*nick_colors)) | |
97 | |
98 #define SCALE(x) \ | |
99 ((gdk_pixbuf_animation_get_width(x) <= 48 && \ | |
100 gdk_pixbuf_animation_get_height(x) <= 48) ? 48 : 50) | |
101 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
102 typedef struct |
4359 | 103 { |
104 GtkWidget *window; | |
105 | |
106 GtkWidget *entry; | |
107 GtkWidget *message; | |
108 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
109 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
110 |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
111 } InviteBuddyInfo; |
4359 | 112 |
113 char fontface[128] = { 0 }; | |
114 int fontsize = 3; | |
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, |
413 "<FONT SIZE=\"%d\">%s</FONT>", fontsize, buf); | |
414 strcpy(buf, buf2); | |
415 } | |
416 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
417 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_fgcolor")) { |
4359 | 418 g_snprintf(buf2, limit, |
419 "<FONT COLOR=\"#%02X%02X%02X\">%s</FONT>", | |
420 gtkconv->fg_color.red / 256, | |
421 gtkconv->fg_color.green / 256, | |
422 gtkconv->fg_color.blue / 256, buf); | |
423 strcpy(buf, buf2); | |
424 } | |
425 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
426 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_bgcolor")) { |
4359 | 427 g_snprintf(buf2, limit, |
428 "<BODY BGCOLOR=\"#%02X%02X%02X\">%s</BODY>", | |
4421 | 429 gtkconv->bg_color.red / 256, |
430 gtkconv->bg_color.green / 256, | |
431 gtkconv->bg_color.blue / 256, buf); | |
4359 | 432 strcpy(buf, buf2); |
433 } | |
434 } | |
435 | |
436 g_free(buf2); | |
437 | |
438 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) | |
439 gaim_im_send(GAIM_IM(conv), buf); | |
440 else | |
441 gaim_chat_send(GAIM_CHAT(conv), buf); | |
442 | |
5629 | 443 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
|
444 gaim_window_hide(gaim_conversation_get_window(conv)); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
445 |
4359 | 446 g_free(buf); |
447 | |
448 gtk_text_buffer_set_text(gtkconv->entry_buffer, "", -1); | |
449 } | |
450 | |
451 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
452 add_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 453 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
454 GaimConnection *gc; |
4359 | 455 struct buddy *b; |
456 const char *name; | |
457 | |
458 gc = gaim_conversation_get_gc(conv); | |
459 name = gaim_conversation_get_name(conv); | |
4687 | 460 b = gaim_find_buddy(gc->account, name); |
4359 | 461 |
462 if (b != NULL) | |
5975 | 463 show_confirm_del(b); |
4359 | 464 else if (gc != NULL) |
465 show_add_buddy(gc, (char *)name, NULL, NULL); | |
466 | |
467 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
468 } | |
469 | |
470 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
471 info_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 472 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
473 GaimGtkConversation *gtkconv; |
4359 | 474 |
475 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
476 | |
477 if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
478 GaimGtkChatPane *gtkchat; |
4359 | 479 GtkTreeIter iter; |
480 GtkTreeModel *model; | |
481 GtkTreeSelection *sel; | |
482 const char *name; | |
483 | |
484 gtkchat = gtkconv->u.chat; | |
485 | |
486 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | |
487 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); | |
488 | |
489 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) | |
490 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &name, -1); | |
491 else | |
492 return; | |
493 | |
494 serv_get_info(gaim_conversation_get_gc(conv), (char *)name); | |
495 } | |
496 else { | |
497 serv_get_info(gaim_conversation_get_gc(conv), | |
498 (char *)gaim_conversation_get_name(conv)); | |
499 | |
500 gtk_widget_grab_focus(gtkconv->entry); | |
501 } | |
502 } | |
503 | |
504 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
505 warn_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 506 { |
507 show_warn_dialog(gaim_conversation_get_gc(conv), | |
508 (char *)gaim_conversation_get_name(conv)); | |
509 | |
510 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
511 } | |
512 | |
513 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
514 block_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 515 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
516 GaimConnection *gc; |
4359 | 517 |
518 gc = gaim_conversation_get_gc(conv); | |
519 | |
520 if (gc != NULL) | |
521 show_add_perm(gc, (char *)gaim_conversation_get_name(conv), FALSE); | |
522 | |
523 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
524 } | |
525 | |
526 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
527 do_invite(GtkWidget *w, int resp, InviteBuddyInfo *info) |
4359 | 528 { |
529 const char *buddy, *message; | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
530 GaimGtkConversation *gtkconv; |
4359 | 531 |
532 gtkconv = GAIM_GTK_CONVERSATION(info->conv); | |
533 | |
534 if (resp == GTK_RESPONSE_OK) { | |
535 buddy = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(info->entry)->entry)); | |
536 message = gtk_entry_get_text(GTK_ENTRY(info->message)); | |
537 | |
4793 | 538 if (!g_ascii_strcasecmp(buddy, "")) { |
4359 | 539 g_free(info); |
540 | |
541 return; | |
542 } | |
543 | |
544 serv_chat_invite(gaim_conversation_get_gc(info->conv), | |
545 gaim_chat_get_id(GAIM_CHAT(info->conv)), | |
546 message, buddy); | |
547 } | |
548 | |
549 gtk_widget_destroy(invite_dialog); | |
550 invite_dialog = NULL; | |
551 | |
552 g_free(info); | |
553 } | |
554 | |
555 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
556 invite_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 557 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
558 InviteBuddyInfo *info = NULL; |
4359 | 559 |
560 if (invite_dialog == NULL) { | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
561 GaimConnection *gc; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
562 GaimWindow *win; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
563 GaimGtkWindow *gtkwin; |
4359 | 564 GtkWidget *label; |
565 GtkWidget *vbox, *hbox; | |
566 GtkWidget *table; | |
567 GtkWidget *img; | |
568 | |
5024 | 569 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG); |
4359 | 570 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
571 info = g_new0(InviteBuddyInfo, 1); |
4359 | 572 info->conv = conv; |
573 | |
574 gc = gaim_conversation_get_gc(conv); | |
575 win = gaim_conversation_get_window(conv); | |
576 gtkwin = GAIM_GTK_WINDOW(win); | |
577 | |
578 /* Create the new dialog. */ | |
579 invite_dialog = gtk_dialog_new_with_buttons( | |
580 _("Gaim - Invite Buddy Into Chat Room"), | |
581 GTK_WINDOW(gtkwin->window), | |
582 GTK_DIALOG_MODAL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, | |
583 GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); | |
584 | |
585 gtk_dialog_set_default_response(GTK_DIALOG(invite_dialog), | |
586 GTK_RESPONSE_OK); | |
587 gtk_container_set_border_width(GTK_CONTAINER(invite_dialog), 6); | |
588 gtk_window_set_resizable(GTK_WINDOW(invite_dialog), FALSE); | |
589 gtk_dialog_set_has_separator(GTK_DIALOG(invite_dialog), FALSE); | |
590 | |
591 /* Setup the outside spacing. */ | |
592 vbox = GTK_DIALOG(invite_dialog)->vbox; | |
593 | |
594 gtk_box_set_spacing(GTK_BOX(vbox), 12); | |
595 gtk_container_set_border_width(GTK_CONTAINER(vbox), 6); | |
596 | |
597 /* Setup the inner hbox and put the dialog's icon in it. */ | |
598 hbox = gtk_hbox_new(FALSE, 12); | |
599 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
600 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
601 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
602 | |
603 /* Setup the right vbox. */ | |
604 vbox = gtk_vbox_new(FALSE, 0); | |
605 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
606 | |
607 /* Put our happy label in it. */ | |
608 label = gtk_label_new(_("Please enter the name of the user you wish " | |
609 "to invite, along with an optional invite " | |
610 "message.")); | |
611 gtk_widget_set_size_request(label, 350, -1); | |
612 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
613 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
614 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
615 | |
616 /* hbox for the table, and to give it some spacing on the left. */ | |
617 hbox = gtk_hbox_new(FALSE, 6); | |
618 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
619 | |
620 /* Setup the table we're going to use to lay stuff out. */ | |
621 table = gtk_table_new(2, 2, FALSE); | |
622 gtk_table_set_row_spacings(GTK_TABLE(table), 6); | |
623 gtk_table_set_col_spacings(GTK_TABLE(table), 6); | |
624 gtk_container_set_border_width(GTK_CONTAINER(table), 12); | |
625 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); | |
626 | |
627 /* Now the Buddy label */ | |
628 label = gtk_label_new(NULL); | |
629 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Buddy:")); | |
630 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
631 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); | |
632 | |
633 /* Now the Buddy drop-down entry field. */ | |
634 info->entry = gtk_combo_new(); | |
635 gtk_combo_set_case_sensitive(GTK_COMBO(info->entry), FALSE); | |
636 gtk_entry_set_activates_default( | |
637 GTK_ENTRY(GTK_COMBO(info->entry)->entry), TRUE); | |
638 | |
639 gtk_table_attach_defaults(GTK_TABLE(table), info->entry, 1, 2, 0, 1); | |
640 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->entry); | |
641 | |
642 /* Fill in the names. */ | |
643 gtk_combo_set_popdown_strings(GTK_COMBO(info->entry), | |
644 generate_invite_user_names(gc)); | |
645 | |
646 | |
647 /* Now the label for "Message" */ | |
648 label = gtk_label_new(NULL); | |
649 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Message:")); | |
650 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
651 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); | |
652 | |
653 | |
654 /* And finally, the Message entry field. */ | |
655 info->message = gtk_entry_new(); | |
656 gtk_entry_set_activates_default(GTK_ENTRY(info->message), TRUE); | |
657 | |
658 gtk_table_attach_defaults(GTK_TABLE(table), info->message, 1, 2, 1, 2); | |
659 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->message); | |
660 | |
661 /* Connect the signals. */ | |
662 g_signal_connect(G_OBJECT(invite_dialog), "response", | |
663 G_CALLBACK(do_invite), info); | |
664 } | |
665 | |
666 gtk_widget_show_all(invite_dialog); | |
667 | |
668 if (info != NULL) | |
669 gtk_widget_grab_focus(GTK_COMBO(info->entry)->entry); | |
670 } | |
671 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
672 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
673 menu_save_as_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
674 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
675 GaimWindow *win = (GaimWindow *)data; |
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 save_convo(NULL, gaim_window_get_active_conversation(win)); |
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 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
680 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
681 menu_view_log_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
682 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
683 GaimWindow *win = (GaimWindow *)data; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
684 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
685 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
686 conv = gaim_window_get_active_conversation(win); |
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_show_log(NULL, (char *)gaim_conversation_get_name(conv)); |
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 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
691 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
692 menu_add_pounce_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
693 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
694 GaimWindow *win = (GaimWindow *)data; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
695 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
696 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
697 conv = gaim_window_get_active_conversation(win); |
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 gaim_gtkpounce_dialog_show(gaim_conversation_get_account(conv), |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
700 gaim_conversation_get_name(conv), NULL); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
701 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
702 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
703 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
704 menu_insert_link_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
705 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
706 GaimWindow *win = (GaimWindow *)data; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
707 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
708 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
709 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
710 conv = gaim_window_get_active_conversation(win); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
711 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
712 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
713 show_insert_link(gtkconv->toolbar.link, 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 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
716 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
717 menu_insert_image_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
718 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
719 GaimWindow *win = (GaimWindow *)data; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
720 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
721 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
722 gtkconv = GAIM_GTK_CONVERSATION(gaim_window_get_active_conversation(win)); |
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 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.image), |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
725 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.image))); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
726 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
727 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
728 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
729 menu_alias_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
730 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
731 GaimWindow *win = (GaimWindow *)data; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
732 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
733 struct buddy *b; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
734 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
735 conv = gaim_window_get_active_conversation(win); |
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 b = gaim_find_buddy(gaim_conversation_get_account(conv), |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
738 gaim_conversation_get_name(conv)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
739 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
740 if (b != NULL) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
741 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
742 alias_dialog_bud(b); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
743 #if 0 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
744 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
745 alias_dialog_chat((struct chat *)b); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
746 #endif |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
747 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
748 } |
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 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
751 menu_get_info_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
752 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
753 GaimWindow *win = (GaimWindow *)data; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
754 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
755 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
756 conv = gaim_window_get_active_conversation(win); |
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 info_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
759 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
760 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
761 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
762 menu_invite_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
763 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
764 GaimWindow *win = (GaimWindow *)data; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
765 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
766 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
767 conv = gaim_window_get_active_conversation(win); |
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 invite_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
770 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
771 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
772 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
773 menu_warn_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
774 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
775 GaimWindow *win = (GaimWindow *)data; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
776 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
777 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
778 conv = gaim_window_get_active_conversation(win); |
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 warn_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
781 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
782 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
783 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
784 menu_block_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
785 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
786 GaimWindow *win = (GaimWindow *)data; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
787 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
788 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
789 conv = gaim_window_get_active_conversation(win); |
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 block_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
792 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
793 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
794 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
795 menu_add_remove_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
796 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
797 GaimWindow *win = (GaimWindow *)data; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
798 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
799 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
800 conv = gaim_window_get_active_conversation(win); |
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 add_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
803 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
804 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
805 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
806 menu_close_conv_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
807 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
808 GaimWindow *win = (GaimWindow *)data; |
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 close_conv_cb(NULL, gaim_window_get_active_conversation(win)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
811 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
812 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
813 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
814 menu_logging_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
815 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
816 GaimWindow *win = (GaimWindow *)data; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
817 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
818 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
819 conv = gaim_window_get_active_conversation(win); |
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 if (conv == NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
822 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
823 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
824 gaim_conversation_set_logging(conv, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
825 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
826 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
827 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
828 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
829 menu_sounds_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
830 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
831 GaimWindow *win = (GaimWindow *)data; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
832 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
833 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
834 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
835 conv = gaim_window_get_active_conversation(win); |
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 if (!conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
838 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
839 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
840 gtkconv = GAIM_GTK_CONVERSATION(conv); |
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->make_sound = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
843 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
844 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
845 |
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 void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
849 im_cb(GtkWidget *widget, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
850 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
851 GaimConversation *conv2; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
852 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
853 GaimGtkChatPane *gtkchat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
854 GaimAccount *account; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
855 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
856 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
857 GtkTreeSelection *sel; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
858 const char *name; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
859 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
860 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
861 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
862 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
863 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
864 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
865 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
866 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
867 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
|
868 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
869 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
870 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
871 if (*name == '@') name++; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
872 if (*name == '%') name++; |
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 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
875 account = gaim_conversation_get_account(conv); |
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 conv2 = gaim_find_conversation(name); |
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 if (conv2 != NULL) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
880 gaim_window_raise(gaim_conversation_get_window(conv2)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
881 gaim_conversation_set_account(conv2, account); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
882 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
883 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
884 conv2 = gaim_conversation_new(GAIM_CONV_IM, account, name); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
885 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
886 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
887 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
888 ignore_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
889 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
890 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
891 GaimGtkChatPane *gtkchat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
892 GaimChat *chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
893 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
894 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
895 GtkTreeSelection *sel; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
896 const char *name; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
897 int pos; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
898 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
899 chat = GAIM_CHAT(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
900 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
901 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
902 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
903 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
904 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
905 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
906 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
907 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
|
908 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
909 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
910 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
911 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
912 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
913 pos = g_list_index(gaim_chat_get_users(chat), name); |
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 if (gaim_chat_is_user_ignored(chat, name)) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
916 gaim_chat_unignore(chat, name); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
917 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
918 gaim_chat_ignore(chat, name); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
919 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
920 add_chat_buddy_common(conv, name, pos); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
921 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
922 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
923 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
924 menu_chat_im_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
925 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
926 const char *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
927 GaimConversation *conv2; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
928 GaimAccount *account; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
929 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
930 who = g_object_get_data(G_OBJECT(w), "user_data"); |
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 account = gaim_conversation_get_account(conv); |
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 conv2 = gaim_find_conversation(who); |
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 if (conv2 != NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
937 gaim_window_show(gaim_conversation_get_window(conv2)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
938 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
939 conv2 = gaim_conversation_new(GAIM_CONV_IM, account, who); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
940 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
941 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
942 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
943 menu_chat_info_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
944 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
945 GaimPluginProtocolInfo *prpl_info = NULL; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
946 GaimConnection *gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
947 char *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
948 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
949 gc = gaim_conversation_get_gc(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
950 who = g_object_get_data(G_OBJECT(w), "user_data"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
951 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
952 if (gc != NULL) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
953 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
954 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
955 /* |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
956 * If there are special needs for getting info on users in |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
957 * buddy chat "rooms"... |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
958 */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
959 if (prpl_info->get_cb_info != NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
960 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
|
961 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
962 prpl_info->get_info(gc, who); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
963 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
964 } |
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 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
967 menu_chat_get_away_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
968 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
969 GaimPluginProtocolInfo *prpl_info = NULL; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
970 GaimConnection *gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
971 char *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
972 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
973 gc = gaim_conversation_get_gc(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
974 who = g_object_get_data(G_OBJECT(w), "user_data"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
975 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
976 if (gc != NULL) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
977 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
978 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
979 /* |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
980 * 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
|
981 */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
982 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
983 if (prpl_info->get_cb_away != NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
984 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
|
985 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
986 } |
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 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
989 menu_chat_add_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
990 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
991 GaimConnection *gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
992 struct buddy *b; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
993 char *name; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
994 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
995 gc = gaim_conversation_get_gc(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
996 name = g_object_get_data(G_OBJECT(w), "user_data"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
997 b = gaim_find_buddy(gc->account, name); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
998 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
999 if (b != NULL) |
5975 | 1000 show_confirm_del(b); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1001 else if (gc != NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1002 show_add_buddy(gc, name, NULL, NULL); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1003 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1004 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); |
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 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1007 static gint |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1008 right_click_chat_cb(GtkWidget *widget, GdkEventButton *event, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1009 GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1010 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1011 GaimPluginProtocolInfo *prpl_info = NULL; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1012 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1013 GaimGtkChatPane *gtkchat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1014 GaimConnection *gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1015 GaimAccount *account; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1016 GtkTreePath *path; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1017 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1018 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1019 GtkTreeViewColumn *column; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1020 gchar *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1021 int x, y; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1022 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1023 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1024 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1025 account = gaim_conversation_get_account(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1026 gc = account->gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1027 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1028 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1029 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1030 gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(gtkchat->list), |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1031 event->x, event->y, &path, &column, &x, &y); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1032 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1033 if (path == NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1034 return FALSE; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1035 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1036 if (gc != NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1037 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1038 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1039 gtk_tree_selection_select_path(GTK_TREE_SELECTION( |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1040 gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list))), path); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1041 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1042 gtk_tree_model_get_iter(GTK_TREE_MODEL(model), &iter, path); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1043 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
|
1044 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1045 if (*who == '@') who++; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1046 if (*who == '%') who++; |
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 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1049 if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1050 GaimConversation *c; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1051 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1052 if ((c = gaim_find_conversation(who)) == NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1053 c = gaim_conversation_new(GAIM_CONV_IM, account, who); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1054 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1055 gaim_conversation_set_account(c, account); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1056 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1057 else if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1058 static GtkWidget *menu = NULL; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1059 GtkWidget *button; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1060 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1061 /* |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1062 * If a menu already exists, destroy it before creating a new one, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1063 * thus freeing-up the memory it occupied. |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1064 */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1065 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1066 if (menu) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1067 gtk_widget_destroy(menu); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1068 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1069 menu = gtk_menu_new(); |
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 button = gtk_menu_item_new_with_label(_("IM")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1072 g_signal_connect(G_OBJECT(button), "activate", |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1073 G_CALLBACK(menu_chat_im_cb), conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1074 g_object_set_data(G_OBJECT(button), "user_data", who); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1075 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1076 gtk_widget_show(button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1077 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1078 if (gaim_chat_is_user_ignored(GAIM_CHAT(conv), who)) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1079 button = gtk_menu_item_new_with_label(_("Un-Ignore")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1080 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1081 button = gtk_menu_item_new_with_label(_("Ignore")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1082 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1083 g_signal_connect(G_OBJECT(button), "activate", |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1084 G_CALLBACK(ignore_cb), conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1085 g_object_set_data(G_OBJECT(button), "user_data", who); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1086 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1087 gtk_widget_show(button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1088 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1089 if (gc && prpl_info->get_info) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1090 button = gtk_menu_item_new_with_label(_("Info")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1091 g_signal_connect(G_OBJECT(button), "activate", |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1092 G_CALLBACK(menu_chat_info_cb), conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1093 g_object_set_data(G_OBJECT(button), "user_data", who); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1094 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1095 gtk_widget_show(button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1096 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1097 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1098 if (gc && prpl_info->get_cb_away) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1099 button = gtk_menu_item_new_with_label(_("Get Away Msg")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1100 g_signal_connect(G_OBJECT(button), "activate", |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1101 G_CALLBACK(menu_chat_get_away_cb), conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1102 g_object_set_data(G_OBJECT(button), "user_data", who); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1103 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1104 gtk_widget_show(button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1105 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1106 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1107 /* Added by Jonas <jonas@birme.se> */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1108 if (gc) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1109 if (gaim_find_buddy(gc->account, who)) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1110 button = gtk_menu_item_new_with_label(_("Remove")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1111 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1112 button = gtk_menu_item_new_with_label(_("Add")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1113 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1114 g_signal_connect(G_OBJECT(button), "activate", |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1115 G_CALLBACK(menu_chat_add_cb), conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1116 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1117 g_object_set_data(G_OBJECT(button), "user_data", who); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1118 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1119 gtk_widget_show(button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1120 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1121 /* End Jonas */ |
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 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1124 event->button, event->time); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1125 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1126 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1127 return TRUE; |
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 |
4359 | 1130 static gboolean |
1131 entry_key_pressed_cb_2(GtkWidget *entry, GdkEventKey *event, gpointer data) | |
1132 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1133 GaimWindow *win; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1134 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1135 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1136 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1137 |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1138 conv = (GaimConversation *)data; |
4359 | 1139 gtkconv = GAIM_GTK_CONVERSATION(conv); |
1140 win = gaim_conversation_get_window(conv); | |
4362 | 1141 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 1142 |
1143 if (event->keyval == GDK_Escape) { | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1144 if (gaim_prefs_get_bool("/gaim/gtk/conversations/escape_closes")) { |
4359 | 1145 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); |
1146 gaim_conversation_destroy(conv); | |
1147 } | |
1148 } | |
1149 else if (event->keyval == GDK_Page_Up) { | |
1150 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1151 | |
1152 if (!(event->state & GDK_CONTROL_MASK)) | |
1153 gtk_imhtml_page_up(GTK_IMHTML(gtkconv->imhtml)); | |
1154 } | |
1155 else if (event->keyval == GDK_Page_Down) { | |
1156 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1157 | |
1158 if (!(event->state & GDK_CONTROL_MASK)) | |
1159 gtk_imhtml_page_down(GTK_IMHTML(gtkconv->imhtml)); | |
1160 } | |
6033 | 1161 else if (event->keyval == GDK_F2) { |
1162 | |
1163 gaim_prefs_set_bool("/gaim/gtk/conversations/show_timestamps", | |
1164 !gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); | |
4359 | 1165 } |
1166 else if (event->keyval == GDK_Return || event->keyval == GDK_KP_Enter) { | |
1167 if ((event->state & GDK_CONTROL_MASK) && | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1168 gaim_prefs_get_bool("/gaim/gtk/conversations/ctrl_enter_sends")) { |
4359 | 1169 |
1170 send_cb(NULL, conv); | |
1171 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1172 | |
1173 return TRUE; | |
1174 } | |
1175 else if (!(event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK)) && | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1176 gaim_prefs_get_bool("/gaim/gtk/conversations/enter_sends")) { |
4359 | 1177 |
1178 send_cb(NULL, conv); | |
1179 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1180 | |
1181 return TRUE; | |
1182 } | |
1183 | |
1184 return FALSE; | |
1185 } | |
6014 | 1186 else if ((event->state & GDK_CONTROL_MASK) && (event->keyval == 'm' || |
1187 event->keyval == 'M')) { | |
4359 | 1188 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); |
1189 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, "\n", 1); | |
1190 } | |
1191 else if (event->state & GDK_CONTROL_MASK) { | |
1192 switch (event->keyval) { | |
1193 case GDK_Up: | |
1194 if (!conv->send_history) | |
1195 break; | |
1196 | |
1197 if (!conv->send_history->prev) { | |
1198 GtkTextIter start, end; | |
1199 | |
1200 if (conv->send_history->data) | |
1201 g_free(conv->send_history->data); | |
1202 | |
1203 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, | |
1204 &start); | |
1205 gtk_text_buffer_get_end_iter(gtkconv->entry_buffer, &end); | |
1206 | |
1207 conv->send_history->data = | |
1208 gtk_text_buffer_get_text(gtkconv->entry_buffer, | |
1209 &start, &end, FALSE); | |
1210 } | |
1211 | |
1212 if (conv->send_history->next && | |
1213 conv->send_history->next->data) { | |
1214 | |
1215 conv->send_history = conv->send_history->next; | |
1216 gtk_text_buffer_set_text(gtkconv->entry_buffer, | |
1217 conv->send_history->data, -1); | |
1218 } | |
1219 | |
1220 break; | |
1221 | |
1222 case GDK_Down: | |
1223 if (!conv->send_history) | |
1224 break; | |
1225 | |
1226 if (conv->send_history->prev) { | |
1227 conv->send_history = conv->send_history->prev; | |
1228 | |
1229 if (conv->send_history->data) | |
1230 gtk_text_buffer_set_text(gtkconv->entry_buffer, | |
1231 conv->send_history->data, -1); | |
1232 } | |
1233 | |
1234 break; | |
1235 } | |
1236 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1237 if (gaim_prefs_get_bool("/gaim/gtk/conversations/html_shortcuts")) { |
4359 | 1238 switch (event->keyval) { |
1239 case 'i': | |
1240 case 'I': | |
4685 | 1241 set_toggle(gtkconv->toolbar.italic, |
4359 | 1242 !gtk_toggle_button_get_active( |
1243 GTK_TOGGLE_BUTTON(gtkconv->toolbar.italic))); | |
1244 | |
1245 g_signal_stop_emission_by_name(G_OBJECT(entry), | |
1246 "key_press_event"); | |
1247 break; | |
1248 | |
1249 case 'u': /* ctrl-u is GDK_Clear, which clears the line. */ | |
1250 case 'U': | |
4685 | 1251 set_toggle(gtkconv->toolbar.underline, |
4359 | 1252 !gtk_toggle_button_get_active( |
1253 GTK_TOGGLE_BUTTON(gtkconv->toolbar.underline))); | |
1254 | |
1255 g_signal_stop_emission_by_name(G_OBJECT(entry), | |
1256 "key_press_event"); | |
1257 break; | |
1258 | |
1259 case 'b': /* ctrl-b is GDK_Left, which moves backwards. */ | |
1260 case 'B': | |
4685 | 1261 set_toggle(gtkconv->toolbar.bold, |
4359 | 1262 !gtk_toggle_button_get_active( |
1263 GTK_TOGGLE_BUTTON(gtkconv->toolbar.bold))); | |
1264 | |
1265 g_signal_stop_emission_by_name(G_OBJECT(entry), | |
1266 "key_press_event"); | |
1267 break; | |
6014 | 1268 |
4359 | 1269 case '-': |
6015 | 1270 set_toggle(gtkconv->toolbar.smaller_size, |
1271 !gtk_toggle_button_get_active( | |
1272 GTK_TOGGLE_BUTTON(gtkconv->toolbar.smaller_size))); | |
6014 | 1273 |
4359 | 1274 g_signal_stop_emission_by_name(G_OBJECT(entry), |
1275 "key_press_event"); | |
1276 break; | |
1277 | |
1278 case '=': | |
1279 case '+': | |
6015 | 1280 set_toggle(gtkconv->toolbar.larger_size, |
1281 !gtk_toggle_button_get_active( | |
1282 GTK_TOGGLE_BUTTON(gtkconv->toolbar.larger_size))); | |
4359 | 1283 |
1284 g_signal_stop_emission_by_name(G_OBJECT(entry), | |
1285 "key_press_event"); | |
1286 break; | |
1287 | |
1288 case '0': | |
4685 | 1289 set_toggle(gtkconv->toolbar.normal_size, |
1290 !gtk_toggle_button_get_active( | |
1291 GTK_TOGGLE_BUTTON(gtkconv->toolbar.normal_size))); | |
4359 | 1292 |
1293 g_signal_stop_emission_by_name(G_OBJECT(entry), | |
1294 "key_press_event"); | |
1295 break; | |
1296 | |
1297 case 'f': | |
1298 case 'F': | |
4685 | 1299 set_toggle(gtkconv->toolbar.font, |
4359 | 1300 !gtk_toggle_button_get_active( |
4685 | 1301 GTK_TOGGLE_BUTTON(gtkconv->toolbar.font))); |
4359 | 1302 |
1303 g_signal_stop_emission_by_name(G_OBJECT(entry), | |
1304 "key_press_event"); | |
1305 break; | |
1306 } | |
1307 } | |
1308 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1309 if (gaim_prefs_get_bool("/gaim/gtk/conversations/smiley_shortcuts")) { |
4359 | 1310 char buf[7]; |
1311 | |
1312 *buf = '\0'; | |
1313 | |
1314 switch (event->keyval) { | |
1315 case '1': strcpy(buf, ":-)"); break; | |
1316 case '2': strcpy(buf, ":-("); break; | |
1317 case '3': strcpy(buf, ";-)"); break; | |
1318 case '4': strcpy(buf, ":-P"); break; | |
1319 case '5': strcpy(buf, "=-O"); break; | |
1320 case '6': strcpy(buf, ":-*"); break; | |
1321 case '7': strcpy(buf, ">:o"); break; | |
1322 case '8': strcpy(buf, "8-)"); break; | |
1323 case '!': strcpy(buf, ":-$"); break; | |
1324 case '@': strcpy(buf, ":-!"); break; | |
1325 case '#': strcpy(buf, ":-["); break; | |
1326 case '$': strcpy(buf, "O:-)"); break; | |
1327 case '%': strcpy(buf, ":-/"); break; | |
1328 case '^': strcpy(buf, ":'("); break; | |
1329 case '&': strcpy(buf, ":-X"); break; | |
1330 case '*': strcpy(buf, ":-D"); break; | |
1331 default: break; | |
1332 } | |
1333 | |
1334 if (*buf) { | |
1335 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, | |
1336 buf, -1); | |
1337 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1338 } | |
1339 } | |
1340 | |
1341 if (event->keyval == 'l') { | |
1342 gtk_imhtml_clear(GTK_IMHTML(gtkconv->imhtml)); | |
1343 g_string_free(conv->history, TRUE); | |
1344 conv->history = g_string_new(""); | |
1345 } | |
6033 | 1346 else if (event->keyval == 'w') { |
4359 | 1347 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); |
6033 | 1348 |
4359 | 1349 gaim_conversation_destroy(conv); |
6033 | 1350 |
4359 | 1351 return TRUE; |
1352 } | |
1353 else if (event->keyval == 'n') { | |
1354 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1355 | |
1356 show_im_dialog(); | |
1357 } | |
1358 else if (event->keyval == 'z') { | |
1359 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
5133 | 1360 |
1361 gtk_window_iconify(GTK_WINDOW(gtkwin->window)); | |
4359 | 1362 } |
1363 else if (event->keyval == '[') { | |
1364 gaim_window_switch_conversation(win, | |
1365 gaim_conversation_get_index(conv) - 1); | |
1366 | |
1367 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1368 } | |
1369 else if (event->keyval == ']') { | |
1370 gaim_window_switch_conversation(win, | |
1371 gaim_conversation_get_index(conv) + 1); | |
1372 | |
1373 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1374 } | |
1375 else if (event->keyval == GDK_Tab) { | |
1376 move_next_tab(conv); | |
1377 | |
1378 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1379 | |
1380 return TRUE; | |
1381 } | |
1382 } | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1383 else if (event->keyval == GDK_Tab && |
4359 | 1384 gaim_conversation_get_type(conv) == GAIM_CONV_CHAT && |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1385 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/tab_completion")) { |
4359 | 1386 |
1387 tab_complete(conv); | |
1388 | |
1389 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1390 | |
1391 return TRUE; | |
1392 } | |
1393 else if ((event->state & GDK_MOD1_MASK) && | |
1394 event->keyval > '0' && event->keyval <= '9') { | |
1395 | |
1396 gaim_window_switch_conversation(win, event->keyval - '1'); | |
1397 | |
1398 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1399 } | |
1400 | |
1401 return FALSE; | |
1402 } | |
1403 | |
1404 /* | |
1405 * NOTE: | |
1406 * This guy just kills a single right click from being propagated any | |
1407 * further. I have no idea *why* we need this, but we do ... It | |
1408 * prevents right clicks on the GtkTextView in a convo dialog from | |
1409 * going all the way down to the notebook. I suspect a bug in | |
1410 * GtkTextView, but I'm not ready to point any fingers yet. | |
1411 */ | |
1412 static gboolean | |
1413 entry_stop_rclick_cb(GtkWidget *widget, GdkEventButton *event, gpointer data) | |
1414 { | |
1415 if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { | |
1416 /* Right single click */ | |
1417 g_signal_stop_emission_by_name(G_OBJECT(widget), "button_press_event"); | |
1418 | |
1419 return TRUE; | |
1420 } | |
1421 | |
1422 return FALSE; | |
1423 } | |
1424 | |
6057 | 1425 static gboolean |
1426 refocus_entry_cb(GtkWidget *widget, GdkEventButton *event, gpointer data) | |
1427 { | |
1428 GaimGtkConversation *gtkconv = data; | |
1429 | |
1430 gtk_widget_grab_focus(gtkconv->entry); | |
1431 | |
1432 return FALSE; | |
1433 } | |
1434 | |
4359 | 1435 static void |
4673 | 1436 menu_conv_sel_send_cb(GObject *m, gpointer data) |
4359 | 1437 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1438 GaimWindow *win = g_object_get_data(m, "user_data"); |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
1439 GaimAccount *account = g_object_get_data(m, "gaim_account"); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1440 GaimConversation *conv; |
4359 | 1441 |
1442 conv = gaim_window_get_active_conversation(win); | |
1443 | |
4491 | 1444 gaim_conversation_set_account(conv, account); |
4359 | 1445 } |
1446 | |
1447 static void | |
1448 insert_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *position, | |
1449 gchar *new_text, gint new_text_length, gpointer user_data) | |
1450 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1451 GaimConversation *conv = (GaimConversation *)user_data; |
4359 | 1452 |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1453 g_return_if_fail(conv != NULL); |
4359 | 1454 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1455 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) |
4359 | 1456 return; |
1457 | |
1458 got_typing_keypress(conv, (gtk_text_iter_is_start(position) && | |
1459 gtk_text_iter_is_end(position))); | |
1460 } | |
1461 | |
1462 static void | |
1463 delete_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *start_pos, | |
1464 GtkTextIter *end_pos, gpointer user_data) | |
1465 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1466 GaimConversation *conv = (GaimConversation *)user_data; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1467 GaimIm *im; |
4359 | 1468 |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1469 g_return_if_fail(conv != NULL); |
4359 | 1470 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1471 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) |
4359 | 1472 return; |
1473 | |
1474 im = GAIM_IM(conv); | |
1475 | |
1476 if (gtk_text_iter_is_start(start_pos) && gtk_text_iter_is_end(end_pos)) { | |
1477 | |
1478 /* We deleted all the text, so turn off typing. */ | |
1479 if (gaim_im_get_type_again_timeout(im)) | |
1480 gaim_im_stop_type_again_timeout(im); | |
1481 | |
1482 /* XXX The (char *) should go away! Somebody add consts to stuff! */ | |
1483 serv_send_typing(gaim_conversation_get_gc(conv), | |
1484 (char *)gaim_conversation_get_name(conv), | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
1485 GAIM_NOT_TYPING); |
4359 | 1486 } |
1487 else { | |
1488 /* We're deleting, but not all of it, so it counts as typing. */ | |
1489 got_typing_keypress(conv, FALSE); | |
1490 } | |
1491 } | |
1492 | |
1493 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1494 notebook_init_grab(GaimGtkWindow *gtkwin, GtkWidget *widget) |
4359 | 1495 { |
1496 static GdkCursor *cursor = NULL; | |
1497 | |
1498 gtkwin->in_drag = TRUE; | |
1499 | |
1500 if (gtkwin->drag_leave_signal) { | |
1501 g_signal_handler_disconnect(G_OBJECT(widget), | |
1502 gtkwin->drag_leave_signal); | |
1503 | |
1504 gtkwin->drag_leave_signal = 0; | |
1505 } | |
1506 | |
1507 if (cursor == NULL) | |
1508 cursor = gdk_cursor_new(GDK_FLEUR); | |
1509 | |
1510 /* Grab the pointer */ | |
1511 gtk_grab_add(gtkwin->notebook); | |
5114
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1512 #ifndef _WIN32 |
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1513 /* 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
|
1514 always be true after a button press. */ |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1515 if (!gdk_pointer_is_grabbed()) |
5114
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1516 #endif |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1517 gdk_pointer_grab(gtkwin->notebook->window, FALSE, |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1518 GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1519 NULL, cursor, GDK_CURRENT_TIME); |
4359 | 1520 } |
1521 | |
1522 static gboolean | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1523 notebook_motion_cb(GtkWidget *widget, GdkEventButton *e, GaimWindow *win) |
4359 | 1524 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1525 GaimGtkWindow *gtkwin; |
4359 | 1526 |
1527 gtkwin = GAIM_GTK_WINDOW(win); | |
1528 | |
1529 /* | |
1530 * Make sure the user moved the mouse far enough for the | |
1531 * drag to be initiated. | |
1532 */ | |
1533 if (gtkwin->in_predrag) { | |
1534 if (e->x_root < gtkwin->drag_min_x || | |
1535 e->x_root >= gtkwin->drag_max_x || | |
1536 e->y_root < gtkwin->drag_min_y || | |
1537 e->y_root >= gtkwin->drag_max_y) { | |
1538 | |
1539 gtkwin->in_predrag = FALSE; | |
1540 notebook_init_grab(gtkwin, widget); | |
1541 } | |
1542 } | |
1543 else { /* Otherwise, draw the arrows. */ | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1544 GaimWindow *dest_win; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1545 GaimGtkWindow *dest_gtkwin; |
4359 | 1546 GtkNotebook *dest_notebook; |
1547 GtkWidget *tab, *last_vis_tab = NULL; | |
1548 gint nb_x, nb_y, page_num, i, last_vis_tab_loc = -1; | |
1549 gint arrow1_x, arrow1_y, arrow2_x, arrow2_y; | |
1550 gboolean horiz_tabs = FALSE, tab_found = FALSE; | |
1551 GList *l; | |
1552 | |
1553 /* Get the window that the cursor is over. */ | |
1554 dest_win = gaim_gtkwin_get_at_xy(e->x_root, e->y_root); | |
1555 | |
1556 if (dest_win == NULL) { | |
1557 dnd_hints_hide_all(); | |
1558 | |
1559 return TRUE; | |
1560 } | |
1561 | |
1562 dest_gtkwin = GAIM_GTK_WINDOW(dest_win); | |
1563 | |
1564 dest_notebook = GTK_NOTEBOOK(dest_gtkwin->notebook); | |
1565 | |
1566 gdk_window_get_origin(GTK_WIDGET(dest_notebook)->window, &nb_x, &nb_y); | |
1567 | |
1568 arrow1_x = arrow2_x = nb_x; | |
1569 arrow1_y = arrow2_y = nb_y; | |
1570 | |
1571 page_num = gaim_gtkconv_get_dest_tab_at_xy(dest_win, | |
1572 e->x_root, e->y_root); | |
1573 | |
1574 if (gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_TOP || | |
1575 gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_BOTTOM) { | |
1576 | |
1577 horiz_tabs = TRUE; | |
1578 } | |
1579 | |
1580 /* Find out where to put the arrows. */ | |
1581 for (l = gaim_window_get_conversations(dest_win), i = 0; | |
1582 l != NULL; | |
1583 l = l->next, i++) { | |
1584 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1585 GaimConversation *conv = l->data; |
4359 | 1586 |
1587 tab = GAIM_GTK_CONVERSATION(conv)->tabby; | |
1588 | |
1589 /* | |
1590 * If this is the correct tab, record the positions | |
1591 * for the arrows. | |
1592 */ | |
1593 if (i == page_num) { | |
1594 if (horiz_tabs) { | |
1595 arrow1_x = arrow2_x = nb_x + tab->allocation.x; | |
1596 arrow1_y = nb_y + tab->allocation.y; | |
1597 arrow2_y = nb_y + tab->allocation.y + | |
1598 tab->allocation.height; | |
1599 } | |
1600 else { | |
1601 arrow1_x = nb_x + tab->allocation.x; | |
1602 arrow2_x = nb_x + tab->allocation.x + | |
1603 tab->allocation.width; | |
1604 arrow1_y = arrow2_y = nb_y + tab->allocation.y; | |
1605 } | |
1606 | |
1607 tab_found = TRUE; | |
1608 break; | |
1609 } | |
1610 else { /* Keep track of the right-most tab that we see. */ | |
1611 if (horiz_tabs && tab->allocation.x > last_vis_tab_loc) { | |
1612 last_vis_tab = tab; | |
1613 last_vis_tab_loc = tab->allocation.x; | |
1614 } | |
1615 else if (!horiz_tabs && tab->allocation.y > last_vis_tab_loc) { | |
1616 last_vis_tab = tab; | |
1617 last_vis_tab_loc = tab->allocation.y; | |
1618 } | |
1619 } | |
1620 } | |
1621 | |
1622 /* | |
1623 * If we didn't find the tab, then we'll just place the | |
1624 * arrows to the right/bottom of the last visible tab. | |
1625 */ | |
1626 if (!tab_found && last_vis_tab) { | |
1627 if (horiz_tabs) { | |
1628 arrow1_x = arrow2_x = nb_x + last_vis_tab->allocation.x + | |
1629 last_vis_tab->allocation.width; | |
1630 arrow1_y = nb_y + last_vis_tab->allocation.y; | |
1631 arrow2_y = nb_y + last_vis_tab->allocation.y + | |
1632 last_vis_tab->allocation.height; | |
1633 } | |
1634 else { | |
1635 arrow1_x = nb_x + last_vis_tab->allocation.x; | |
1636 arrow2_x = nb_x + last_vis_tab->allocation.x + | |
1637 last_vis_tab->allocation.width; | |
1638 arrow1_y = arrow2_y = nb_y + last_vis_tab->allocation.y + | |
1639 last_vis_tab->allocation.height; | |
1640 } | |
1641 } | |
1642 | |
1643 if (horiz_tabs) { | |
1644 dnd_hints_show(HINT_ARROW_DOWN, arrow1_x, arrow1_y); | |
1645 dnd_hints_show(HINT_ARROW_UP, arrow2_x, arrow2_y); | |
1646 } | |
1647 else { | |
1648 dnd_hints_show(HINT_ARROW_RIGHT, arrow1_x, arrow1_y); | |
1649 dnd_hints_show(HINT_ARROW_LEFT, arrow2_x, arrow2_y); | |
1650 } | |
1651 } | |
1652 | |
1653 return TRUE; | |
1654 } | |
1655 | |
1656 static gboolean | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1657 notebook_leave_cb(GtkWidget *widget, GdkEventCrossing *e, GaimWindow *win) |
4359 | 1658 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1659 GaimGtkWindow *gtkwin; |
4359 | 1660 |
1661 gtkwin = GAIM_GTK_WINDOW(win); | |
1662 | |
1663 if (gtkwin->in_drag) | |
1664 return FALSE; | |
1665 | |
1666 if (e->x_root < gtkwin->drag_min_x || | |
1667 e->x_root >= gtkwin->drag_max_x || | |
1668 e->y_root < gtkwin->drag_min_y || | |
1669 e->y_root >= gtkwin->drag_max_y) { | |
1670 | |
1671 gtkwin->in_predrag = FALSE; | |
1672 notebook_init_grab(gtkwin, widget); | |
1673 } | |
1674 | |
1675 return TRUE; | |
1676 } | |
1677 | |
1678 /* | |
1679 * THANK YOU GALEON! | |
1680 */ | |
1681 static gboolean | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1682 notebook_press_cb(GtkWidget *widget, GdkEventButton *e, GaimWindow *win) |
4359 | 1683 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1684 GaimGtkWindow *gtkwin; |
4359 | 1685 gint nb_x, nb_y, x_rel, y_rel; |
1686 GList *l; | |
1687 int tab_clicked; | |
1688 | |
1689 if (e->button != 1 || e->type != GDK_BUTTON_PRESS) | |
1690 return FALSE; | |
1691 | |
1692 gtkwin = GAIM_GTK_WINDOW(win); | |
1693 | |
1694 if (gtkwin->in_drag) { | |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1695 gaim_debug(GAIM_DEBUG_WARNING, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1696 "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
|
1697 return TRUE; |
4359 | 1698 } |
1699 | |
1700 /* | |
1701 * Make sure a tab was actually clicked. The arrow buttons | |
1702 * mess things up. | |
1703 */ | |
1704 tab_clicked = gaim_gtkconv_get_tab_at_xy(win, e->x_root, e->y_root); | |
1705 | |
1706 if (tab_clicked == -1) | |
1707 return FALSE; | |
1708 | |
1709 /* | |
1710 * Get the relative position of the press event, with regards to | |
1711 * the position of the notebook. | |
1712 */ | |
1713 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
1714 | |
1715 x_rel = e->x_root - nb_x; | |
1716 y_rel = e->y_root - nb_y; | |
1717 | |
1718 /* Reset the min/max x/y */ | |
1719 gtkwin->drag_min_x = 0; | |
1720 gtkwin->drag_min_y = 0; | |
1721 gtkwin->drag_max_x = 0; | |
1722 gtkwin->drag_max_y = 0; | |
1723 | |
1724 /* Find out which tab was dragged. */ | |
1725 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
|
1726 GaimConversation *conv = l->data; |
4359 | 1727 GtkWidget *tab = GAIM_GTK_CONVERSATION(conv)->tabby; |
1728 | |
1729 if (!GTK_WIDGET_VISIBLE(tab)) | |
1730 continue; | |
1731 | |
1732 if (tab->allocation.x > x_rel || tab->allocation.y > y_rel) | |
1733 break; | |
1734 | |
1735 /* Save the borders of the tab. */ | |
1736 gtkwin->drag_min_x = tab->allocation.x + nb_x; | |
1737 gtkwin->drag_min_y = tab->allocation.y + nb_y; | |
1738 gtkwin->drag_max_x = tab->allocation.width + gtkwin->drag_min_x; | |
1739 gtkwin->drag_max_y = tab->allocation.height + gtkwin->drag_min_y; | |
1740 } | |
1741 | |
1742 /* Make sure the click occurred in the tab. */ | |
1743 if (e->x_root < gtkwin->drag_min_x || | |
1744 e->x_root >= gtkwin->drag_max_x || | |
1745 e->y_root < gtkwin->drag_min_y || | |
1746 e->y_root >= gtkwin->drag_max_y) { | |
1747 | |
1748 return FALSE; | |
1749 } | |
1750 | |
1751 gtkwin->in_predrag = TRUE; | |
1752 | |
1753 /* Connect the new motion signals. */ | |
1754 gtkwin->drag_motion_signal = | |
1755 g_signal_connect(G_OBJECT(widget), "motion_notify_event", | |
1756 G_CALLBACK(notebook_motion_cb), win); | |
1757 | |
1758 gtkwin->drag_leave_signal = | |
1759 g_signal_connect(G_OBJECT(widget), "leave_notify_event", | |
1760 G_CALLBACK(notebook_leave_cb), win); | |
1761 | |
1762 return FALSE; | |
1763 } | |
1764 | |
1765 static gboolean | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1766 notebook_release_cb(GtkWidget *widget, GdkEventButton *e, GaimWindow *win) |
4359 | 1767 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1768 GaimWindow *dest_win; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1769 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1770 GaimGtkWindow *dest_gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1771 GaimConversation *conv; |
4359 | 1772 GtkNotebook *dest_notebook; |
1773 gint dest_page_num; | |
1774 | |
1775 /* | |
1776 * Don't check to make sure that the event's window matches the | |
1777 * widget's, because we may be getting an event passed on from the | |
1778 * close button. | |
1779 */ | |
1780 if (e->button != 1 && e->type != GDK_BUTTON_RELEASE) | |
1781 return FALSE; | |
1782 | |
1783 if (gdk_pointer_is_grabbed()) { | |
1784 gdk_pointer_ungrab(GDK_CURRENT_TIME); | |
1785 gtk_grab_remove(widget); | |
1786 } | |
1787 | |
1788 gtkwin = GAIM_GTK_WINDOW(win); | |
1789 | |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1790 if (!gtkwin->in_predrag && !gtkwin->in_drag) |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1791 return FALSE; |
4359 | 1792 |
1793 /* Disconnect the motion signal. */ | |
1794 if (gtkwin->drag_motion_signal) { | |
1795 g_signal_handler_disconnect(G_OBJECT(widget), | |
1796 gtkwin->drag_motion_signal); | |
1797 | |
1798 gtkwin->drag_motion_signal = 0; | |
1799 } | |
1800 | |
1801 /* | |
1802 * If we're in a pre-drag, we'll also need to disconnect the leave | |
1803 * signal. | |
1804 */ | |
1805 if (gtkwin->in_predrag) { | |
1806 gtkwin->in_predrag = FALSE; | |
1807 | |
1808 if (gtkwin->drag_leave_signal) { | |
1809 g_signal_handler_disconnect(G_OBJECT(widget), | |
1810 gtkwin->drag_leave_signal); | |
1811 | |
1812 gtkwin->drag_leave_signal = 0; | |
1813 } | |
1814 } | |
1815 | |
1816 /* If we're not in drag... */ | |
1817 /* We're perfectly normal people! */ | |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1818 if (!gtkwin->in_drag) |
4359 | 1819 return FALSE; |
1820 | |
1821 gtkwin->in_drag = FALSE; | |
1822 | |
1823 dnd_hints_hide_all(); | |
1824 | |
4369
7e1fb422e5fd
[gaim-migrate @ 4635]
Christian Hammond <chipx86@chipx86.com>
parents:
4368
diff
changeset
|
1825 dest_win = gaim_gtkwin_get_at_xy(e->x_root, e->y_root); |
4359 | 1826 |
1827 conv = gaim_window_get_active_conversation(win); | |
1828 | |
1829 if (dest_win == NULL) { | |
1830 if (gaim_window_get_conversation_count(win) < 2) | |
1831 return FALSE; | |
1832 | |
1833 if (gaim_window_get_conversation_count(win) > 1) { | |
1834 /* Make a new window to stick this to. */ | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1835 GaimWindow *new_win; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1836 GaimGtkWindow *new_gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1837 GaimGtkConversation *gtkconv; |
4748
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1838 gint win_width, win_height; |
5121 | 1839 |
1840 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4359 | 1841 |
1842 new_win = gaim_window_new(); | |
5121 | 1843 |
5139
d0182ae31ab8
[gaim-migrate @ 5503]
Christian Hammond <chipx86@chipx86.com>
parents:
5133
diff
changeset
|
1844 gaim_window_add_conversation(new_win, |
d0182ae31ab8
[gaim-migrate @ 5503]
Christian Hammond <chipx86@chipx86.com>
parents:
5133
diff
changeset
|
1845 gaim_window_remove_conversation(win, |
d0182ae31ab8
[gaim-migrate @ 5503]
Christian Hammond <chipx86@chipx86.com>
parents:
5133
diff
changeset
|
1846 gaim_conversation_get_index(conv))); |
5121 | 1847 |
4748
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1848 new_gtkwin = GAIM_GTK_WINDOW(new_win); |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1849 |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1850 gtk_window_get_size(GTK_WINDOW(new_gtkwin->window), |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1851 &win_width, &win_height); |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1852 |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1853 gtk_window_move(GTK_WINDOW(new_gtkwin->window), |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1854 e->x_root - (win_width / 2), |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1855 e->y_root - (win_height / 2)); |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1856 |
4359 | 1857 gaim_window_show(new_win); |
1858 } | |
1859 | |
1860 return TRUE; | |
1861 } | |
1862 | |
4369
7e1fb422e5fd
[gaim-migrate @ 4635]
Christian Hammond <chipx86@chipx86.com>
parents:
4368
diff
changeset
|
1863 dest_gtkwin = GAIM_GTK_WINDOW(dest_win); |
7e1fb422e5fd
[gaim-migrate @ 4635]
Christian Hammond <chipx86@chipx86.com>
parents:
4368
diff
changeset
|
1864 |
4359 | 1865 /* Get the destination notebook. */ |
1866 dest_notebook = GTK_NOTEBOOK(gtkwin->notebook); | |
1867 | |
1868 /* Get the destination page number. */ | |
1869 dest_page_num = gaim_gtkconv_get_dest_tab_at_xy(dest_win, | |
1870 e->x_root, e->y_root); | |
1871 | |
1872 if (win == dest_win) { | |
1873 gaim_window_move_conversation(win, | |
1874 gaim_conversation_get_index(conv), dest_page_num); | |
1875 } | |
1876 else { | |
1877 size_t pos; | |
1878 | |
1879 gaim_window_remove_conversation(win, | |
1880 gaim_conversation_get_index(conv)); | |
1881 | |
1882 pos = gaim_window_add_conversation(dest_win, conv); | |
1883 | |
5901
74e273e22f94
[gaim-migrate @ 6333]
Christian Hammond <chipx86@chipx86.com>
parents:
5881
diff
changeset
|
1884 if (pos != dest_page_num) |
74e273e22f94
[gaim-migrate @ 6333]
Christian Hammond <chipx86@chipx86.com>
parents:
5881
diff
changeset
|
1885 gaim_window_move_conversation(dest_win, pos, dest_page_num); |
4359 | 1886 |
1887 gaim_window_switch_conversation(dest_win, dest_page_num); | |
1888 } | |
1889 | |
1890 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
1891 | |
1892 return TRUE; | |
1893 } | |
1894 | |
1895 static void | |
1896 switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, | |
1897 gpointer user_data) | |
1898 { | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
1899 GaimPluginProtocolInfo *prpl_info = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1900 GaimWindow *win; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1901 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1902 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1903 GaimGtkWindow *gtkwin; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
1904 GaimConnection *gc; |
4359 | 1905 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1906 win = (GaimWindow *)user_data; |
4359 | 1907 |
4598
a064e437d5eb
[gaim-migrate @ 4883]
Christian Hammond <chipx86@chipx86.com>
parents:
4596
diff
changeset
|
1908 conv = gaim_window_get_conversation_at(win, page_num); |
a064e437d5eb
[gaim-migrate @ 4883]
Christian Hammond <chipx86@chipx86.com>
parents:
4596
diff
changeset
|
1909 |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1910 g_return_if_fail(conv != NULL); |
4598
a064e437d5eb
[gaim-migrate @ 4883]
Christian Hammond <chipx86@chipx86.com>
parents:
4596
diff
changeset
|
1911 |
4359 | 1912 gc = gaim_conversation_get_gc(conv); |
1913 gtkwin = GAIM_GTK_WINDOW(win); | |
1914 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1915 | |
1916 gaim_conversation_set_unseen(conv, GAIM_UNSEEN_NONE); | |
1917 | |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
1918 if (gc != NULL) { |
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
1919 gtk_widget_set_sensitive(gtkwin->menu.insert_link, TRUE); |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
1920 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
1921 } |
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
1922 |
4359 | 1923 /* Update the menubar */ |
1924 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1925 gtk_widget_show(gtkwin->menu.view_log); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1926 |
5929
b85e88d3fa5f
[gaim-migrate @ 6369]
Christian Hammond <chipx86@chipx86.com>
parents:
5911
diff
changeset
|
1927 if (gc && prpl_info->options & OPT_PROTO_IM_IMAGE) { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1928 gtk_widget_show(gtkwin->menu.insert_image); |
5929
b85e88d3fa5f
[gaim-migrate @ 6369]
Christian Hammond <chipx86@chipx86.com>
parents:
5911
diff
changeset
|
1929 gtk_widget_set_sensitive(gtkconv->toolbar.image, TRUE); |
b85e88d3fa5f
[gaim-migrate @ 6369]
Christian Hammond <chipx86@chipx86.com>
parents:
5911
diff
changeset
|
1930 |
b85e88d3fa5f
[gaim-migrate @ 6369]
Christian Hammond <chipx86@chipx86.com>
parents:
5911
diff
changeset
|
1931 } |
b85e88d3fa5f
[gaim-migrate @ 6369]
Christian Hammond <chipx86@chipx86.com>
parents:
5911
diff
changeset
|
1932 else { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1933 gtk_widget_hide(gtkwin->menu.insert_image); |
5929
b85e88d3fa5f
[gaim-migrate @ 6369]
Christian Hammond <chipx86@chipx86.com>
parents:
5911
diff
changeset
|
1934 gtk_widget_set_sensitive(gtkconv->toolbar.image, FALSE); |
b85e88d3fa5f
[gaim-migrate @ 6369]
Christian Hammond <chipx86@chipx86.com>
parents:
5911
diff
changeset
|
1935 } |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1936 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1937 gtk_widget_show(gtkwin->menu.add_pounce); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1938 gtk_widget_show(gtkwin->menu.get_info); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1939 gtk_widget_show(gtkwin->menu.warn); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1940 gtk_widget_show(gtkwin->menu.block); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1941 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1942 if (gaim_find_buddy(gaim_conversation_get_account(conv), |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1943 gaim_conversation_get_name(conv)) == NULL) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1944 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1945 gtk_widget_show(gtkwin->menu.add); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1946 gtk_widget_hide(gtkwin->menu.remove); |
5911
865f235ffaf0
[gaim-migrate @ 6343]
Christian Hammond <chipx86@chipx86.com>
parents:
5908
diff
changeset
|
1947 gtk_widget_set_sensitive(gtkwin->menu.alias, FALSE); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1948 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1949 else { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1950 gtk_widget_show(gtkwin->menu.remove); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1951 gtk_widget_hide(gtkwin->menu.add); |
5911
865f235ffaf0
[gaim-migrate @ 6343]
Christian Hammond <chipx86@chipx86.com>
parents:
5908
diff
changeset
|
1952 gtk_widget_set_sensitive(gtkwin->menu.alias, TRUE); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1953 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1954 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1955 gtk_widget_set_sensitive(gtkwin->menu.add, TRUE); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1956 gtk_widget_set_sensitive(gtkwin->menu.remove, TRUE); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1957 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1958 gtk_widget_hide(gtkwin->menu.invite); |
4359 | 1959 |
1960 if (gtkwin->menu.send_as != NULL) | |
4685 | 1961 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); |
4359 | 1962 } |
6030
54c37db13279
[gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents:
6016
diff
changeset
|
1963 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1964 gtk_widget_show(gtkwin->menu.invite); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1965 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1966 gtk_widget_hide(gtkwin->menu.view_log); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1967 gtk_widget_hide(gtkwin->menu.insert_image); |
5929
b85e88d3fa5f
[gaim-migrate @ 6369]
Christian Hammond <chipx86@chipx86.com>
parents:
5911
diff
changeset
|
1968 gtk_widget_set_sensitive(gtkconv->toolbar.image, FALSE); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1969 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1970 gtk_widget_set_sensitive(gtkwin->menu.alias, FALSE); |
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_hide(gtkwin->menu.add_pounce); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1973 gtk_widget_hide(gtkwin->menu.get_info); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1974 gtk_widget_hide(gtkwin->menu.warn); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1975 gtk_widget_hide(gtkwin->menu.block); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1976 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1977 if (gaim_find_chat(gaim_conversation_get_gc(conv), |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1978 gaim_chat_get_id(GAIM_CHAT(conv))) == NULL) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1979 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1980 gtk_widget_show(gtkwin->menu.add); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1981 gtk_widget_hide(gtkwin->menu.remove); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1982 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1983 else { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1984 gtk_widget_show(gtkwin->menu.remove); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1985 gtk_widget_hide(gtkwin->menu.add); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1986 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1987 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1988 gtk_widget_set_sensitive(gtkwin->menu.add, FALSE); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1989 gtk_widget_set_sensitive(gtkwin->menu.remove, FALSE); |
4359 | 1990 |
1991 if (gtkwin->menu.send_as != NULL) | |
6030
54c37db13279
[gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents:
6016
diff
changeset
|
1992 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); |
4359 | 1993 } |
1994 | |
4736 | 1995 update_typing_icon(conv); |
1996 | |
4359 | 1997 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.logging), |
1998 gaim_conversation_is_logging(conv)); | |
1999 | |
2000 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.sounds), | |
2001 gtkconv->make_sound); | |
2002 | |
2003 gtk_widget_grab_focus(gtkconv->entry); | |
4681 | 2004 |
4965 | 2005 gtk_window_set_title(GTK_WINDOW(gtkwin->window), |
5462
8355eeeb52a3
[gaim-migrate @ 5853]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2006 gtk_label_get_text(GTK_LABEL(gtkconv->tab_label))); |
4359 | 2007 } |
2008 | |
2009 /************************************************************************** | |
2010 * Utility functions | |
2011 **************************************************************************/ | |
2012 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2013 do_bold(GtkWidget *bold, GaimGtkConversation *gtkconv) |
4359 | 2014 { |
2015 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(bold))) | |
2016 gaim_gtk_surround(gtkconv, "<B>", "</B>"); | |
2017 else | |
2018 gaim_gtk_advance_past(gtkconv, "<B>", "</B>"); | |
2019 | |
2020 gtk_widget_grab_focus(gtkconv->entry); | |
2021 } | |
2022 | |
2023 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2024 do_italic(GtkWidget *italic, GaimGtkConversation *gtkconv) |
4359 | 2025 { |
2026 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(italic))) | |
2027 gaim_gtk_surround(gtkconv, "<I>", "</I>"); | |
2028 else | |
2029 gaim_gtk_advance_past(gtkconv, "<I>", "</I>"); | |
2030 | |
2031 gtk_widget_grab_focus(gtkconv->entry); | |
2032 } | |
2033 | |
2034 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2035 do_underline(GtkWidget *underline, GaimGtkConversation *gtkconv) |
4359 | 2036 { |
2037 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(underline))) | |
2038 gaim_gtk_surround(gtkconv, "<U>", "</U>"); | |
2039 else | |
2040 gaim_gtk_advance_past(gtkconv, "<U>", "</U>"); | |
2041 | |
2042 gtk_widget_grab_focus(gtkconv->entry); | |
2043 } | |
2044 | |
2045 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2046 do_small(GtkWidget *small, GaimGtkConversation *gtkconv) |
4359 | 2047 { |
5049 | 2048 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(small))) |
2049 gaim_gtk_surround(gtkconv, "<FONT SIZE=\"1\">", "</FONT>"); | |
2050 else | |
2051 gaim_gtk_advance_past(gtkconv, "<FONT SIZE=\"1\">", "</FONT>"); | |
4359 | 2052 |
2053 gtk_widget_grab_focus(gtkconv->entry); | |
2054 } | |
2055 | |
2056 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2057 do_normal(GtkWidget *normal, GaimGtkConversation *gtkconv) |
4359 | 2058 { |
5049 | 2059 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(normal))) |
2060 gaim_gtk_surround(gtkconv, "<FONT SIZE=\"3\">", "</FONT>"); | |
2061 else | |
2062 gaim_gtk_advance_past(gtkconv, "<FONT SIZE=\"3\">", "</FONT>"); | |
4359 | 2063 |
2064 gtk_widget_grab_focus(gtkconv->entry); | |
2065 } | |
2066 | |
2067 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2068 do_big(GtkWidget *large, GaimGtkConversation *gtkconv) |
4359 | 2069 { |
5049 | 2070 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(large))) |
2071 gaim_gtk_surround(gtkconv, "<FONT SIZE=\"5\">", "</FONT>"); | |
2072 else | |
2073 gaim_gtk_advance_past(gtkconv, "<FONT SIZE=\"5\">", "</FONT>"); | |
4359 | 2074 |
2075 gtk_widget_grab_focus(gtkconv->entry); | |
2076 } | |
2077 | |
2078 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2079 toggle_font(GtkWidget *font, GaimConversation *conv) |
4359 | 2080 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2081 GaimGtkConversation *gtkconv; |
4359 | 2082 |
2083 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2084 | |
2085 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(font))) | |
2086 show_font_dialog(conv, font); | |
5582 | 2087 else if (gtkconv->dialogs.font != NULL) |
4359 | 2088 cancel_font(font, conv); |
2089 else | |
2090 gaim_gtk_advance_past(gtkconv, "<FONT FACE>", "</FONT>"); | |
2091 } | |
2092 | |
2093 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2094 toggle_fg_color(GtkWidget *color, GaimConversation *conv) |
4359 | 2095 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2096 GaimGtkConversation *gtkconv; |
4359 | 2097 |
2098 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2099 | |
2100 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(color))) | |
2101 show_fgcolor_dialog(conv, color); | |
2102 else if (gtkconv->dialogs.fg_color != NULL) | |
2103 cancel_fgcolor(color, conv); | |
2104 else | |
2105 gaim_gtk_advance_past(gtkconv, "<FONT COLOR>", "</FONT>"); | |
2106 } | |
2107 | |
2108 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2109 toggle_bg_color(GtkWidget *color, GaimConversation *conv) |
4359 | 2110 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2111 GaimGtkConversation *gtkconv; |
4359 | 2112 |
2113 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2114 | |
2115 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(color))) | |
2116 show_bgcolor_dialog(conv, color); | |
2117 else if (gtkconv->dialogs.bg_color != NULL) | |
2118 cancel_bgcolor(color, conv); | |
2119 else | |
2120 gaim_gtk_advance_past(gtkconv, "<BODY BGCOLOR>", "</BODY>"); | |
2121 } | |
2122 | |
2123 static void | |
2124 check_everything(GtkTextBuffer *buffer) | |
2125 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2126 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2127 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2128 |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2129 conv = (GaimConversation *)g_object_get_data(G_OBJECT(buffer), |
4359 | 2130 "user_data"); |
2131 | |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2132 g_return_if_fail(conv != NULL); |
4359 | 2133 |
2134 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2135 | |
2136 /* CONV TODO */ | |
2137 } | |
2138 | |
2139 static void | |
4685 | 2140 set_toggle(GtkWidget *tb, gboolean active) |
4359 | 2141 { |
2142 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(tb), active); | |
2143 } | |
2144 | |
2145 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2146 got_typing_keypress(GaimConversation *conv, gboolean first) |
4359 | 2147 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2148 GaimIm *im; |
4685 | 2149 |
4359 | 2150 /* |
2151 * 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
|
2152 * send GAIM_TYPED any time soon. |
4359 | 2153 */ |
2154 | |
2155 im = GAIM_IM(conv); | |
2156 | |
2157 if (gaim_im_get_type_again_timeout(im)) | |
2158 gaim_im_stop_type_again_timeout(im); | |
2159 | |
2160 gaim_im_start_type_again_timeout(im); | |
2161 | |
2162 if (first || (gaim_im_get_type_again(im) != 0 && | |
2163 time(NULL) > gaim_im_get_type_again(im))) { | |
2164 | |
2165 int timeout = serv_send_typing(gaim_conversation_get_gc(conv), | |
2166 (char *)gaim_conversation_get_name(conv), | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
2167 GAIM_TYPING); |
4359 | 2168 |
2169 if (timeout) | |
2170 gaim_im_set_type_again(im, time(NULL) + timeout); | |
2171 else | |
2172 gaim_im_set_type_again(im, 0); | |
2173 } | |
2174 } | |
2175 | |
4736 | 2176 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2177 update_typing_icon(GaimConversation *conv) |
4736 | 2178 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2179 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2180 GaimIm *im = NULL; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2181 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); |
4736 | 2182 |
2183 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); | |
2184 | |
2185 if(gaim_conversation_get_type(conv) == GAIM_CONV_IM) | |
2186 im = GAIM_IM(conv); | |
2187 | |
2188 if(gtkwin->menu.typing_icon) { | |
2189 gtk_widget_destroy(gtkwin->menu.typing_icon); | |
2190 gtkwin->menu.typing_icon = NULL; | |
2191 } | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
2192 if(im && gaim_im_get_typing_state(im) == GAIM_TYPING) { |
4736 | 2193 gtkwin->menu.typing_icon = gtk_image_menu_item_new(); |
2194 gtk_image_menu_item_set_image( | |
2195 GTK_IMAGE_MENU_ITEM(gtkwin->menu.typing_icon), | |
2196 gtk_image_new_from_stock(GAIM_STOCK_TYPING, | |
2197 GTK_ICON_SIZE_MENU)); | |
4757 | 2198 gtk_tooltips_set_tip(gtkconv->tooltips, gtkwin->menu.typing_icon, |
4736 | 2199 _("User is typing..."), NULL); |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
2200 } else if(im && gaim_im_get_typing_state(im) == GAIM_TYPED) { |
4736 | 2201 gtkwin->menu.typing_icon = gtk_image_menu_item_new(); |
2202 gtk_image_menu_item_set_image( | |
2203 GTK_IMAGE_MENU_ITEM(gtkwin->menu.typing_icon), | |
2204 gtk_image_new_from_stock(GAIM_STOCK_TYPED, | |
2205 GTK_ICON_SIZE_MENU)); | |
4757 | 2206 gtk_tooltips_set_tip(gtkconv->tooltips, gtkwin->menu.typing_icon, |
4736 | 2207 _("User has typed something and paused"), NULL); |
2208 } | |
2209 | |
2210 if(gtkwin->menu.typing_icon) { | |
2211 gtk_menu_item_set_right_justified( | |
2212 GTK_MENU_ITEM(gtkwin->menu.typing_icon), TRUE); | |
2213 gtk_widget_show_all(gtkwin->menu.typing_icon); | |
2214 gtk_menu_shell_append(GTK_MENU_SHELL(gtkwin->menu.menubar), | |
2215 gtkwin->menu.typing_icon); | |
2216 } | |
2217 } | |
2218 | |
4685 | 2219 static gboolean |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2220 update_send_as_selection(GaimWindow *win) |
4359 | 2221 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2222 GaimAccount *account; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2223 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2224 GaimGtkWindow *gtkwin; |
4359 | 2225 GtkWidget *menu; |
2226 GList *child; | |
2227 | |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2228 g_return_val_if_fail(g_list_find(gaim_get_windows(), win) != NULL, FALSE); |
4849 | 2229 |
4359 | 2230 conv = gaim_window_get_active_conversation(win); |
2231 | |
5860
52d5fad43950
[gaim-migrate @ 6291]
Christian Hammond <chipx86@chipx86.com>
parents:
5858
diff
changeset
|
2232 if (conv == NULL) |
52d5fad43950
[gaim-migrate @ 6291]
Christian Hammond <chipx86@chipx86.com>
parents:
5858
diff
changeset
|
2233 return FALSE; |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2234 |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2235 account = gaim_conversation_get_account(conv); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2236 gtkwin = GAIM_GTK_WINDOW(win); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2237 |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2238 g_return_val_if_fail(account != NULL, FALSE); |
4466
473de7371a97
[gaim-migrate @ 4741]
Christian Hammond <chipx86@chipx86.com>
parents:
4465
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) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3910 if (!gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) |
4383
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3911 fprintf(fd, |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3912 "<HR><BR><H3 Align=Center> " |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3913 "---- New Conversation @ %s ----</H3><BR>\n", |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3914 full_date()); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3915 else |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3916 fprintf(fd, "---- New Conversation @ %s ----\n", |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3917 full_date()); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3918 |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3919 fclose(fd); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3920 } |
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 |
4359 | 3923 /* Setup the container for the tab. */ |
3924 gtkconv->tab_cont = tab_cont = gtk_vbox_new(FALSE, 5); | |
3925 gtk_container_set_border_width(GTK_CONTAINER(tab_cont), 5); | |
3926 gtk_container_add(GTK_CONTAINER(tab_cont), pane); | |
3927 gtk_widget_show(pane); | |
3928 | |
3929 new_ui = TRUE; | |
4636 | 3930 |
4359 | 3931 gtkconv->make_sound = TRUE; |
5902
6889b89cab90
[gaim-migrate @ 6334]
Christian Hammond <chipx86@chipx86.com>
parents:
5901
diff
changeset
|
3932 |
6889b89cab90
[gaim-migrate @ 6334]
Christian Hammond <chipx86@chipx86.com>
parents:
5901
diff
changeset
|
3933 g_signal_connect_swapped(G_OBJECT(pane), "focus", |
6889b89cab90
[gaim-migrate @ 6334]
Christian Hammond <chipx86@chipx86.com>
parents:
5901
diff
changeset
|
3934 G_CALLBACK(gtk_widget_grab_focus), |
6889b89cab90
[gaim-migrate @ 6334]
Christian Hammond <chipx86@chipx86.com>
parents:
5901
diff
changeset
|
3935 gtkconv->entry); |
4359 | 3936 } |
3937 | |
3938 gtkconv->tabby = tabby = gtk_hbox_new(FALSE, 5); | |
3939 | |
3940 /* Close button. */ | |
3941 gtkconv->close = gtk_button_new(); | |
3942 gtk_widget_set_size_request(GTK_WIDGET(gtkconv->close), 16, 16); | |
3943 gtk_container_add(GTK_CONTAINER(gtkconv->close), | |
4445 | 3944 gtk_image_new_from_stock(GTK_STOCK_CLOSE, |
3945 GTK_ICON_SIZE_MENU)); | |
4359 | 3946 gtk_button_set_relief(GTK_BUTTON(gtkconv->close), GTK_RELIEF_NONE); |
3947 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->close, | |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
3948 _("Close conversation"), NULL); |
4359 | 3949 |
3950 g_signal_connect(G_OBJECT(gtkconv->close), "clicked", | |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
3951 G_CALLBACK(close_conv_cb), conv); |
4359 | 3952 |
3953 /* Tab label. */ | |
3954 gtkconv->tab_label = gtk_label_new(gaim_conversation_get_title(conv)); | |
3955 #if 0 | |
3956 gtk_misc_set_alignment(GTK_MISC(gtkconv->tab_label), 0.00, 0.5); | |
3957 gtk_misc_set_padding(GTK_MISC(gtkconv->tab_label), 4, 0); | |
3958 #endif | |
3959 | |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3960 |
4359 | 3961 /* Pack it all together. */ |
3962 gtk_box_pack_start(GTK_BOX(tabby), gtkconv->tab_label, TRUE, TRUE, 0); | |
4445 | 3963 gtk_widget_show(gtkconv->tab_label); |
3964 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
|
3965 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3966 if (gaim_prefs_get_bool("/gaim/gtk/conversations/close_on_tabs")) |
4445 | 3967 gtk_widget_show_all(gtkconv->close); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3968 |
4445 | 3969 gtk_widget_show(tabby); |
4359 | 3970 |
3971 | |
3972 /* Add this pane to the conversations notebook. */ | |
3973 gtk_notebook_append_page(GTK_NOTEBOOK(gtkwin->notebook), tab_cont, tabby); | |
3974 gtk_notebook_set_menu_label_text(GTK_NOTEBOOK(gtkwin->notebook), tab_cont, | |
3975 gaim_conversation_get_title(conv)); | |
3976 | |
3977 gtk_widget_show(tab_cont); | |
3978 | |
4818 | 3979 if (gaim_window_get_conversation_count(win) == 1) { |
3980 /* Er, bug in notebooks? Switch to the page manually. */ | |
4359 | 3981 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), 0); |
4851 | 3982 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3983 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3984 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3985 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3986 else |
4818 | 3987 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), TRUE); |
4359 | 3988 |
5204 | 3989 focus_conv = g_list_nth_data(gaim_window_get_conversations(win), |
3990 gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook))); | |
3991 focus_gtkconv = GAIM_GTK_CONVERSATION(focus_conv); | |
3992 gtk_widget_grab_focus(focus_gtkconv->entry); | |
4359 | 3993 |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
3994 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
3995 gaim_gtkconv_update_buddy_icon(conv); |
4359 | 3996 |
3997 if (!new_ui) | |
3998 g_object_unref(gtkconv->tab_cont); | |
3999 | |
4000 if (gaim_window_get_conversation_count(win) == 1) | |
4685 | 4001 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); |
4359 | 4002 } |
4003 | |
4004 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4005 gaim_gtk_remove_conversation(GaimWindow *win, GaimConversation *conv) |
4359 | 4006 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4007 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4008 GaimGtkConversation *gtkconv; |
4359 | 4009 unsigned int index; |
4818 | 4010 GaimConversationType conv_type; |
4011 | |
4012 conv_type = gaim_conversation_get_type(conv); | |
4359 | 4013 index = gaim_conversation_get_index(conv); |
4014 | |
4015 gtkwin = GAIM_GTK_WINDOW(win); | |
4016 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4017 | |
4018 g_object_ref(gtkconv->tab_cont); | |
4019 gtk_object_sink(GTK_OBJECT(gtkconv->tab_cont)); | |
4020 | |
4021 gtk_notebook_remove_page(GTK_NOTEBOOK(gtkwin->notebook), index); | |
4022 | |
4818 | 4023 /* go back to tabless if need be */ |
4024 if (gaim_window_get_conversation_count(win) <= 2) { | |
4025 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4026 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); |
4818 | 4027 } |
4028 | |
4029 | |
4359 | 4030 /* If this window is setup with an inactive gc, regenerate the menu. */ |
4818 | 4031 if (conv_type == GAIM_CONV_IM && |
4359 | 4032 gaim_conversation_get_gc(conv) == NULL) { |
4033 | |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
4034 generate_send_as_items(win, conv); |
4359 | 4035 } |
4036 } | |
4037 | |
4038 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4039 gaim_gtk_move_conversation(GaimWindow *win, GaimConversation *conv, |
4359 | 4040 unsigned int new_index) |
4041 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4042 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4043 GaimGtkConversation *gtkconv; |
4359 | 4044 |
4045 gtkwin = GAIM_GTK_WINDOW(win); | |
4046 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4047 | |
4415
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4048 if (new_index > gaim_conversation_get_index(conv)) |
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4049 new_index--; |
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4050 |
4359 | 4051 gtk_notebook_reorder_child(GTK_NOTEBOOK(gtkwin->notebook), |
4052 gtkconv->tab_cont, new_index); | |
4053 } | |
4054 | |
4055 static int | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4056 gaim_gtk_get_active_index(const GaimWindow *win) |
4359 | 4057 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4058 GaimGtkWindow *gtkwin; |
5680
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4059 int index; |
4359 | 4060 |
4061 gtkwin = GAIM_GTK_WINDOW(win); | |
4062 | |
5680
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4063 index = gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook)); |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4064 |
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 * A fix, because the first conversation may be active, but not |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4067 * appear in the notebook just yet. -- ChipX86 |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4068 */ |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4069 return (index == -1 ? 0 : index); |
4359 | 4070 } |
4071 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4072 static GaimWindowUiOps window_ui_ops = |
4359 | 4073 { |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4074 gaim_gtk_get_conversation_ui_ops, |
4359 | 4075 gaim_gtk_new_window, |
4076 gaim_gtk_destroy_window, | |
4077 gaim_gtk_show, | |
4078 gaim_gtk_hide, | |
4079 gaim_gtk_raise, | |
4080 gaim_gtk_flash, | |
4081 gaim_gtk_switch_conversation, | |
4082 gaim_gtk_add_conversation, | |
4083 gaim_gtk_remove_conversation, | |
4084 gaim_gtk_move_conversation, | |
4085 gaim_gtk_get_active_index | |
4086 }; | |
4087 | |
4088 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4089 update_convo_add_button(GaimConversation *conv) |
4359 | 4090 { |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4091 GaimPluginProtocolInfo *prpl_info = NULL; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4092 GaimWindow *win; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4093 GaimGtkWindow *gtkwin; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4094 GaimGtkConversation *gtkconv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
4095 GaimConnection *gc; |
4359 | 4096 GaimConversationType type; |
4097 GtkWidget *parent; | |
4098 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4099 gc = gaim_conversation_get_gc(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4100 win = gaim_conversation_get_window(conv); |
4359 | 4101 type = gaim_conversation_get_type(conv); |
4102 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4103 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4104 parent = gtk_widget_get_parent(gtkconv->u.im->add); |
4105 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4106 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4107 |
4687 | 4108 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
|
4109 gtkconv->u.im->add = |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4110 gaim_gtk_change_text(_("Remove"), gtkconv->u.im->add, |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4111 GTK_STOCK_REMOVE, type); |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4112 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->u.im->add, |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4113 _("Remove the user from your buddy list"), NULL); |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4114 |
4359 | 4115 gtk_widget_set_sensitive(gtkconv->u.im->add, |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4116 (gc != NULL && prpl_info->remove_buddy != NULL)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4117 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4118 if (gaim_window_get_active_conversation(win) == conv) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4119 gtk_widget_show(gtkwin->menu.remove); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4120 gtk_widget_hide(gtkwin->menu.add); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4121 } |
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 else { |
4397
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4124 gtkconv->u.im->add = |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4125 gaim_gtk_change_text(_("Add"), gtkconv->u.im->add, |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4126 GTK_STOCK_ADD, type); |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4127 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->u.im->add, |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4128 _("Add the user to your buddy list"), NULL); |
4359 | 4129 |
4130 gtk_widget_set_sensitive(gtkconv->u.im->add, | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4131 (gc != NULL && prpl_info->add_buddy != NULL)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4132 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4133 if (gaim_window_get_active_conversation(win) == conv) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4134 gtk_widget_show(gtkwin->menu.add); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4135 gtk_widget_hide(gtkwin->menu.remove); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4136 } |
4359 | 4137 } |
4138 | |
4397
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4139 g_signal_connect(G_OBJECT(gtkconv->u.im->add), "clicked", |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4140 G_CALLBACK(add_cb), conv); |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4141 |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4142 gtk_box_pack_start(GTK_BOX(parent), gtkconv->u.im->add, |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4143 FALSE, FALSE, 0); |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4144 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
|
4145 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
|
4146 gtk_size_group_add_widget(gtkconv->sg, gtkconv->u.im->add); |
4359 | 4147 } |
4148 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4149 GaimWindowUiOps * |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4150 gaim_get_gtk_window_ui_ops(void) |
4359 | 4151 { |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4152 return &window_ui_ops; |
4359 | 4153 } |
4154 | |
4155 /************************************************************************** | |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4156 * Conversation UI operations |
4359 | 4157 **************************************************************************/ |
4158 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4159 gaim_gtkconv_destroy(GaimConversation *conv) |
4359 | 4160 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4161 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); |
4359 | 4162 |
4163 if (gtkconv->dialogs.fg_color != NULL) | |
4164 gtk_widget_destroy(gtkconv->dialogs.fg_color); | |
4165 | |
4166 if (gtkconv->dialogs.bg_color != NULL) | |
4167 gtk_widget_destroy(gtkconv->dialogs.bg_color); | |
4168 | |
4169 if (gtkconv->dialogs.font != NULL) | |
4170 gtk_widget_destroy(gtkconv->dialogs.font); | |
4171 | |
5959 | 4172 if (gtkconv->dialogs.image != NULL) |
4173 gtk_widget_destroy(gtkconv->dialogs.image); | |
4174 | |
4359 | 4175 if (gtkconv->dialogs.smiley != NULL) |
4176 gtk_widget_destroy(gtkconv->dialogs.smiley); | |
4177 | |
4178 if (gtkconv->dialogs.link != NULL) | |
4179 gtk_widget_destroy(gtkconv->dialogs.link); | |
4180 | |
4181 if (gtkconv->dialogs.log != NULL) | |
4182 gtk_widget_destroy(gtkconv->dialogs.log); | |
4183 | |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4184 gtk_widget_destroy(gtkconv->tab_cont); |
4892 | 4185 g_object_unref(gtkconv->tab_cont); |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4186 |
4359 | 4187 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
4755 | 4188 if (gtkconv->u.im->icon_timer != 0) |
4189 g_source_remove(gtkconv->u.im->icon_timer); | |
4190 | |
4359 | 4191 if (gtkconv->u.im->save_icon != NULL) |
4192 gtk_widget_destroy(gtkconv->u.im->save_icon); | |
4193 | |
4194 if (gtkconv->u.im->anim != NULL) | |
4793 | 4195 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); |
4359 | 4196 |
4197 g_free(gtkconv->u.im); | |
4198 } | |
4199 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
4200 g_free(gtkconv->u.chat); | |
4201 } | |
4202 | |
4633 | 4203 gtk_object_sink(GTK_OBJECT(gtkconv->tooltips)); |
4204 | |
4359 | 4205 g_free(gtkconv); |
4206 } | |
4207 | |
4208 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4209 gaim_gtkconv_write_im(GaimConversation *conv, const char *who, |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4210 const char *message, size_t len, int flags, |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4211 time_t mtime) |
4359 | 4212 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4213 GaimGtkConversation *gtkconv; |
4359 | 4214 |
4215 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4216 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4217 if (!(flags & WFLAG_NOLOG) && |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4218 gaim_prefs_get_bool("/gaim/gtk/conversations/im/raise_on_events")) { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4219 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4220 gaim_window_raise(gaim_conversation_get_window(conv)); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4221 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4222 |
4382
76223649765b
[gaim-migrate @ 4648]
Christian Hammond <chipx86@chipx86.com>
parents:
4378
diff
changeset
|
4223 /* Play a sound, if specified in prefs. */ |
4359 | 4224 if (gtkconv->make_sound) { |
4225 if (flags & WFLAG_RECV) { | |
4226 if (gtkconv->u.im->a_virgin && | |
5820 | 4227 gaim_prefs_get_bool("/gaim/gtk/sound/enabled/first_im_recv")) { |
4359 | 4228 |
4561 | 4229 gaim_sound_play_event(GAIM_SOUND_FIRST_RECEIVE); |
4359 | 4230 } |
4231 else | |
4561 | 4232 gaim_sound_play_event(GAIM_SOUND_RECEIVE); |
4359 | 4233 } |
4234 else { | |
4561 | 4235 gaim_sound_play_event(GAIM_SOUND_SEND); |
4359 | 4236 } |
4237 } | |
4238 | |
4239 gtkconv->u.im->a_virgin = FALSE; | |
4240 | |
4241 gaim_conversation_write(conv, who, message, len, flags, mtime); | |
4242 } | |
4243 | |
4244 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4245 gaim_gtkconv_write_chat(GaimConversation *conv, const char *who, |
4359 | 4246 const char *message, int flags, time_t mtime) |
4247 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4248 GaimGtkConversation *gtkconv; |
4359 | 4249 |
4250 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4251 | |
4382
76223649765b
[gaim-migrate @ 4648]
Christian Hammond <chipx86@chipx86.com>
parents:
4378
diff
changeset
|
4252 /* Play a sound, if specified in prefs. */ |
4359 | 4253 if (gtkconv->make_sound) { |
4254 if (!(flags & WFLAG_WHISPER) && (flags & WFLAG_SEND)) | |
4561 | 4255 gaim_sound_play_event(GAIM_SOUND_CHAT_YOU_SAY); |
4359 | 4256 else if (flags & WFLAG_RECV) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4257 if ((flags & WFLAG_NICK) && |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4258 gaim_prefs_get_bool("/gaim/gtk/sound/nick_said")) { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4259 |
4561 | 4260 gaim_sound_play_event(GAIM_SOUND_CHAT_NICK); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4261 } |
4359 | 4262 else |
4561 | 4263 gaim_sound_play_event(GAIM_SOUND_CHAT_SAY); |
4359 | 4264 } |
4265 } | |
4266 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4267 if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/color_nicks")) |
4359 | 4268 flags |= WFLAG_COLORIZE; |
4269 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4270 /* Raise the window, if specified in prefs. */ |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4271 if (!(flags & WFLAG_NOLOG) && |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4272 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4273 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4274 gaim_window_raise(gaim_conversation_get_window(conv)); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4275 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4276 |
4359 | 4277 gaim_conversation_write(conv, who, message, -1, flags, mtime); |
4278 } | |
4279 | |
4280 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4281 gaim_gtkconv_write_conv(GaimConversation *conv, const char *who, |
4359 | 4282 const char *message, size_t length, int flags, |
4283 time_t mtime) | |
4284 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4285 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4286 GaimWindow *win; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
4287 GaimConnection *gc; |
4359 | 4288 int gtk_font_options = 0; |
4289 GString *log_str; | |
4290 FILE *fd; | |
4291 char buf[BUF_LONG]; | |
4292 char buf2[BUF_LONG]; | |
4293 char mdate[64]; | |
4294 char color[10]; | |
4295 char *str; | |
4296 char *with_font_tag; | |
4896 | 4297 char *sml_attrib = NULL; |
4895 | 4298 |
4299 if(length == -1) | |
4300 length = strlen(message) + 1; | |
4301 | |
4359 | 4302 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4303 gc = gaim_conversation_get_gc(conv); | |
4304 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4305 win = gaim_conversation_get_window(conv); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4306 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4307 if (!(flags & WFLAG_NOLOG) && |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4308 ((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT && |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4309 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) || |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4310 (gaim_conversation_get_type(conv) == GAIM_CONV_IM && |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4311 (gaim_prefs_get_bool("/gaim/gtk/conversations/im/raise_on_events") || |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4312 gaim_prefs_get_bool("/gaim/gtk/conversations/im/hide_on_send"))))) { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4313 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4314 gaim_window_show(win); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4315 } |
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 |
5133 | 4318 if(time(NULL) > mtime + 20*60) /* show date if older than 20 minutes */ |
4319 strftime(mdate, sizeof(mdate), "%Y-%m-%d %H:%M:%S", localtime(&mtime)); | |
4320 else | |
4321 strftime(mdate, sizeof(mdate), "%H:%M:%S", localtime(&mtime)); | |
4359 | 4322 |
4896 | 4323 if(gc) |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4324 sml_attrib = g_strdup_printf("sml=\"%s\"", gc->prpl->info->name); |
4896 | 4325 |
4359 | 4326 gtk_font_options ^= GTK_IMHTML_NO_COMMENTS; |
4327 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4328 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_colors")) |
4359 | 4329 gtk_font_options ^= GTK_IMHTML_NO_COLOURS; |
4330 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4331 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_fonts")) |
4359 | 4332 gtk_font_options ^= GTK_IMHTML_NO_FONTS; |
4333 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4334 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_font_sizes")) |
4359 | 4335 gtk_font_options ^= GTK_IMHTML_NO_SIZES; |
4336 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4337 if (!gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) |
4359 | 4338 gtk_font_options ^= GTK_IMHTML_RETURN_LOG; |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4339 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4340 if (GAIM_PLUGIN_PROTOCOL_INFO(conv->account->gc->prpl)->options & |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4341 OPT_PROTO_USE_POINTSIZE) { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4342 |
5367 | 4343 gtk_font_options ^= GTK_IMHTML_USE_POINTSIZE; |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4344 } |
4359 | 4345 |
4346 if (flags & WFLAG_SYSTEM) { | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4347 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) |
5329 | 4348 g_snprintf(buf, BUF_LONG, "(%s) <B>%s</B>", |
4359 | 4349 mdate, message); |
4350 else | |
4351 g_snprintf(buf, BUF_LONG, "<B>%s</B>", message); | |
4352 | |
4353 g_snprintf(buf2, sizeof(buf2), | |
5329 | 4354 "<!--(%s) --><B>%s</B><BR>", |
4359 | 4355 mdate, message); |
4356 | |
4357 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, -1, 0); | |
4358 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4359 if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) { |
4359 | 4360 char *t1 = strip_html(buf); |
4361 | |
4362 conv->history = g_string_append(conv->history, t1); | |
4363 conv->history = g_string_append(conv->history, "\n"); | |
4364 | |
4365 g_free(t1); | |
4366 } | |
4367 else { | |
4368 conv->history = g_string_append(conv->history, buf); | |
4369 conv->history = g_string_append(conv->history, "<BR>\n"); | |
4370 } | |
4371 | |
4372 if (!(flags & WFLAG_NOLOG) && gaim_conversation_is_logging(conv)) { | |
4373 | |
4374 char *t1; | |
4375 char nm[256]; | |
4376 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4377 if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) |
4359 | 4378 t1 = strip_html(buf); |
4379 else | |
4380 t1 = buf; | |
4381 | |
4382 if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
4383 g_snprintf(nm, sizeof(nm), "%s.chat", | |
4384 gaim_conversation_get_name(conv)); | |
4385 else | |
4386 strncpy(nm, gaim_conversation_get_name(conv), sizeof(nm)); | |
4387 | |
4388 fd = open_log_file(nm, | |
4389 (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT)); | |
4390 | |
4391 if (fd) { | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4392 if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) |
4359 | 4393 fprintf(fd, "%s\n", t1); |
4394 else | |
4395 fprintf(fd, "%s<BR>\n", t1); | |
4396 | |
4397 fclose(fd); | |
4398 } | |
4399 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4400 if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) |
4359 | 4401 g_free(t1); |
4402 } | |
4403 } | |
4404 else if (flags & WFLAG_NOLOG) { | |
4405 g_snprintf(buf, BUF_LONG, | |
4406 "<B><FONT COLOR=\"#777777\">%s</FONT></B><BR>", | |
4407 message); | |
4408 | |
4409 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf, -1, 0); | |
4410 } | |
4411 else { | |
4895 | 4412 char *new_message = g_memdup(message, length); |
4413 | |
4359 | 4414 if (flags & WFLAG_WHISPER) { |
4415 str = g_malloc(1024); | |
4416 | |
4417 /* If we're whispering, it's not an autoresponse. */ | |
4418 if (meify(new_message, length)) { | |
4419 g_snprintf(str, 1024, "***%s", who); | |
4420 strcpy(color, "#6C2585"); | |
4421 } | |
4422 else { | |
4423 g_snprintf(str, 1024, "*%s*:", who); | |
4424 strcpy(color, "#00FF00"); | |
4425 } | |
4426 } | |
4427 else { | |
4428 if (meify(new_message, length)) { | |
4429 str = g_malloc(1024); | |
4430 | |
4431 if (flags & WFLAG_AUTO) | |
4432 g_snprintf(str, 1024, "%s ***%s", AUTO_RESPONSE, who); | |
4433 else | |
4434 g_snprintf(str, 1024, "***%s", who); | |
4435 | |
4436 if (flags & WFLAG_NICK) | |
4437 strcpy(color, "#AF7F00"); | |
4438 else | |
4439 strcpy(color, "#062585"); | |
4440 } | |
4441 else { | |
4442 str = g_malloc(1024); | |
4443 | |
4444 if (flags & WFLAG_AUTO) | |
4445 g_snprintf(str, 1024, "%s %s", who, AUTO_RESPONSE); | |
4446 else | |
4447 g_snprintf(str, 1024, "%s:", who); | |
4448 | |
4449 if (flags & WFLAG_NICK) | |
4450 strcpy(color, "#AF7F00"); | |
4451 else if (flags & WFLAG_RECV) { | |
4452 if (flags & WFLAG_COLORIZE) { | |
4453 const char *u; | |
4454 int m = 0; | |
4455 | |
4456 for (u = who; *u != '\0'; u++) | |
4457 m += *u; | |
4458 | |
4459 m = m % NUM_NICK_COLORS; | |
4460 | |
4461 strcpy(color, nick_colors[m]); | |
4462 } | |
4463 else | |
4464 strcpy(color, "#A82F2F"); | |
4465 } | |
4466 else if (flags & WFLAG_SEND) | |
4467 strcpy(color, "#16569E"); | |
4468 } | |
4469 } | |
4470 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4471 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) |
4359 | 4472 g_snprintf(buf, BUF_LONG, |
5329 | 4473 "<FONT COLOR=\"%s\" %s>(%s) " |
4896 | 4474 "<B>%s</B></FONT> ", color, |
4475 sml_attrib ? sml_attrib : "", mdate, str); | |
4359 | 4476 else |
4477 g_snprintf(buf, BUF_LONG, | |
4896 | 4478 "<FONT COLOR=\"%s\" %s><B>%s</B></FONT> ", color, |
4479 sml_attrib ? sml_attrib : "", str); | |
4359 | 4480 |
4481 g_snprintf(buf2, BUF_LONG, | |
5329 | 4482 "<FONT COLOR=\"%s\" %s><!--(%s) -->" |
4359 | 4483 "<B>%s</B></FONT> ", |
4896 | 4484 color, sml_attrib ? sml_attrib : "", mdate, str); |
4359 | 4485 |
4486 g_free(str); | |
4487 | |
4488 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, -1, 0); | |
4489 | |
4895 | 4490 if(gc){ |
4896 | 4491 char *pre = g_strdup_printf("<font %s>", sml_attrib ? sml_attrib : ""); |
4895 | 4492 char *post = "</font>"; |
4493 int pre_len = strlen(pre); | |
4494 int post_len = strlen(post); | |
4495 | |
4496 with_font_tag = g_malloc(length + pre_len + post_len + 1); | |
4497 | |
4498 strcpy(with_font_tag, pre); | |
4499 memcpy(with_font_tag + pre_len, new_message, length); | |
4500 strcpy(with_font_tag + pre_len + length, post); | |
4501 | |
4502 length += pre_len + post_len; | |
4503 g_free(pre); | |
4504 } | |
4608 | 4505 else |
4895 | 4506 with_font_tag = g_memdup(new_message, length); |
4359 | 4507 |
4508 log_str = gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), | |
4895 | 4509 with_font_tag, length, gtk_font_options); |
4359 | 4510 |
4511 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", -1, 0); | |
4512 | |
4513 /* 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
|
4514 if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) { |
4359 | 4515 char *t1, *t2; |
4516 | |
4517 t1 = strip_html(buf); | |
4518 t2 = strip_html(new_message); | |
4519 | |
4520 conv->history = g_string_append(conv->history, t1); | |
4521 conv->history = g_string_append(conv->history, t2); | |
4522 conv->history = g_string_append(conv->history, "\n"); | |
4523 | |
4524 g_free(t1); | |
4525 g_free(t2); | |
4526 } | |
4527 else { | |
4528 char *t1, *t2; | |
4529 | |
4530 t1 = html_logize(buf); | |
4531 t2 = html_logize(new_message); | |
4532 | |
4533 conv->history = g_string_append(conv->history, t1); | |
4534 conv->history = g_string_append(conv->history, t2); | |
4535 conv->history = g_string_append(conv->history, "\n"); | |
4536 conv->history = g_string_append(conv->history, log_str->str); | |
4537 conv->history = g_string_append(conv->history, "<BR>\n"); | |
4538 | |
4539 g_free(t1); | |
4540 g_free(t2); | |
4541 } | |
4542 | |
4543 /* XXX This needs to be updated for the new length argument. */ | |
4544 if (gaim_conversation_is_logging(conv)) { | |
4545 char *t1, *t2; | |
4546 char nm[256]; | |
4547 | |
4548 if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
4549 g_snprintf(nm, sizeof(nm), "%s.chat", | |
4550 gaim_conversation_get_name(conv)); | |
4551 else | |
4552 strncpy(nm, gaim_conversation_get_name(conv), sizeof(nm)); | |
4553 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4554 if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) { |
4359 | 4555 t1 = strip_html(buf); |
4556 t2 = strip_html(with_font_tag); | |
4557 } | |
4558 else { | |
4559 t1 = html_logize(buf); | |
4560 t2 = html_logize(with_font_tag); | |
4561 } | |
4562 | |
4563 fd = open_log_file(nm, | |
4564 (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT)); | |
4565 | |
4566 if (fd) { | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4567 if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) |
4359 | 4568 fprintf(fd, "%s%s\n", t1, t2); |
4569 else { | |
4570 fprintf(fd, "%s%s%s<BR>\n", t1, t2, log_str->str); | |
4571 g_string_free(log_str, TRUE); | |
4572 } | |
4573 | |
4574 fclose(fd); | |
4575 } | |
4576 | |
4577 g_free(t1); | |
4578 g_free(t2); | |
4579 } | |
4580 | |
4581 g_free(with_font_tag); | |
4582 g_free(new_message); | |
4583 } | |
6062 | 4584 |
5012 | 4585 if(sml_attrib) |
4586 g_free(sml_attrib); | |
4359 | 4587 } |
4588 | |
4589 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4590 gaim_gtkconv_chat_add_user(GaimConversation *conv, const char *user) |
4359 | 4591 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4592 GaimChat *chat; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4593 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4594 GaimGtkChatPane *gtkchat; |
4359 | 4595 char tmp[BUF_LONG]; |
4596 int num_users; | |
4597 int pos; | |
4598 | |
4599 chat = GAIM_CHAT(conv); | |
4600 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4601 gtkchat = gtkconv->u.chat; | |
4602 | |
4603 num_users = g_list_length(gaim_chat_get_users(chat)); | |
4604 | |
4605 g_snprintf(tmp, sizeof(tmp), | |
4606 ngettext("%d person in room", "%d people in room", | |
4607 num_users), | |
4608 num_users); | |
4609 | |
4610 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); | |
4611 | |
4612 if (gtkconv->make_sound) | |
4561 | 4613 gaim_sound_play_event(GAIM_SOUND_CHAT_JOIN); |
4359 | 4614 |
4615 pos = g_list_index(gaim_chat_get_users(chat), user); | |
4616 | |
4617 add_chat_buddy_common(conv, user, pos); | |
4618 } | |
4619 | |
4620 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4621 gaim_gtkconv_chat_rename_user(GaimConversation *conv, const char *old_name, |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4622 const char *new_name) |
4359 | 4623 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4624 GaimChat *chat; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4625 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4626 GaimGtkChatPane *gtkchat; |
4359 | 4627 GtkTreeIter iter; |
4628 GtkTreeModel *model; | |
4629 GList *names; | |
4630 int pos; | |
4631 int f = 1; | |
4632 | |
4633 chat = GAIM_CHAT(conv); | |
4634 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4635 gtkchat = gtkconv->u.chat; | |
4636 | |
4637 for (names = gaim_chat_get_users(chat); | |
4638 names != NULL; | |
4639 names = names->next) { | |
4640 | |
4641 char *u = (char *)names->data; | |
4642 | |
4793 | 4643 if (!gaim_utf8_strcasecmp(u, old_name)) { |
4359 | 4644 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
4645 | |
4646 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
4647 break; | |
4648 | |
4649 while (f != 0) { | |
4650 char *val; | |
4651 | |
4652 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &val, -1); | |
4653 | |
4793 | 4654 if (!gaim_utf8_strcasecmp(old_name, val)) { |
4359 | 4655 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
4640 | 4656 break; |
4657 } | |
4359 | 4658 |
4659 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
4660 | |
4661 g_free(val); | |
4662 } | |
4663 | |
4664 break; | |
4665 } | |
4666 } | |
4667 | |
4668 if (!names) | |
4669 return; | |
4670 | |
4671 pos = g_list_index(gaim_chat_get_users(chat), new_name); | |
4672 | |
4673 add_chat_buddy_common(conv, new_name, pos); | |
4674 } | |
4675 | |
4676 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4677 gaim_gtkconv_chat_remove_user(GaimConversation *conv, const char *user) |
4359 | 4678 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4679 GaimChat *chat; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4680 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4681 GaimGtkChatPane *gtkchat; |
4359 | 4682 GtkTreeIter iter; |
4683 GtkTreeModel *model; | |
4684 GList *names; | |
4685 char tmp[BUF_LONG]; | |
4686 int num_users; | |
4687 int f = 1; | |
4688 | |
4689 chat = GAIM_CHAT(conv); | |
4690 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4691 gtkchat = gtkconv->u.chat; | |
4692 | |
4693 num_users = g_list_length(gaim_chat_get_users(chat)) - 1; | |
4694 | |
4695 for (names = gaim_chat_get_users(chat); | |
4696 names != NULL; | |
4697 names = names->next) { | |
4698 | |
4699 char *u = (char *)names->data; | |
4700 | |
4793 | 4701 if (!gaim_utf8_strcasecmp(u, user)) { |
4359 | 4702 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
4703 | |
4704 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
4705 break; | |
4706 | |
4707 while (f != 0) { | |
4708 char *val; | |
4709 | |
4710 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &val, -1); | |
4711 | |
4793 | 4712 if (!gaim_utf8_strcasecmp(user, val)) |
4359 | 4713 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
4714 | |
4715 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
4716 | |
4717 g_free(val); | |
4718 } | |
4719 | |
4720 break; | |
4721 } | |
4722 } | |
4723 | |
4724 if (names == NULL) | |
4725 return; | |
4726 | |
4727 g_snprintf(tmp, sizeof(tmp), | |
4728 ngettext("%d person in room", "%d people in room", | |
4729 num_users), num_users); | |
4730 | |
4731 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); | |
4732 | |
4733 if (gtkconv->make_sound) | |
4561 | 4734 gaim_sound_play_event(GAIM_SOUND_CHAT_LEAVE); |
4359 | 4735 } |
4736 | |
4737 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4738 gaim_gtkconv_set_title(GaimConversation *conv, const char *title) |
4359 | 4739 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4740 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4741 GaimWindow *win; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4742 GaimGtkWindow *gtkwin; |
4681 | 4743 |
4744 win = gaim_conversation_get_window(conv); | |
4745 gtkwin = GAIM_GTK_WINDOW(win); | |
4359 | 4746 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4747 | |
4748 gtk_label_set_text(GTK_LABEL(gtkconv->tab_label), title); | |
4681 | 4749 |
4750 if(conv == gaim_window_get_active_conversation(win)) | |
4751 gtk_window_set_title(GTK_WINDOW(gtkwin->window), title); | |
4359 | 4752 } |
4753 | |
4754 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4755 gaim_gtkconv_updated(GaimConversation *conv, GaimConvUpdateType type) |
4359 | 4756 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4757 GaimWindow *win; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4758 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4759 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4760 GaimGtkChatPane *gtkchat; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4761 GaimChat *chat; |
4359 | 4762 |
4763 win = gaim_conversation_get_window(conv); | |
4736 | 4764 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4765 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4766 | |
4491 | 4767 if (type == GAIM_CONV_UPDATE_ACCOUNT) { |
4359 | 4768 gaim_conversation_autoset_title(conv); |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
4769 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
4770 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
4771 gaim_gtkconv_update_buddy_icon(conv); |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
4772 |
4359 | 4773 gaim_gtkconv_update_buttons_by_protocol(conv); |
4774 | |
4685 | 4775 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); |
4359 | 4776 |
4777 smiley_themeize(gtkconv->imhtml); | |
4778 } | |
4779 else if (type == GAIM_CONV_UPDATE_TYPING || | |
4780 type == GAIM_CONV_UPDATE_UNSEEN) { | |
4781 GtkStyle *style; | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4782 GaimIm *im = NULL; |
4359 | 4783 |
4736 | 4784 |
4359 | 4785 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
4786 im = GAIM_IM(conv); | |
4787 | |
4788 style = gtk_style_new(); | |
4789 | |
4790 if (!GTK_WIDGET_REALIZED(gtkconv->tab_label)) | |
4791 gtk_widget_realize(gtkconv->tab_label); | |
4792 | |
4757 | 4793 pango_font_description_free(style->font_desc); |
4635 | 4794 style->font_desc = pango_font_description_copy( |
4795 gtk_widget_get_style(gtkconv->tab_label)->font_desc); | |
4359 | 4796 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
4797 if (im != NULL && gaim_im_get_typing_state(im) == GAIM_TYPING) { |
4577 | 4798 style->fg[GTK_STATE_NORMAL].red = 0x4646; |
4799 style->fg[GTK_STATE_NORMAL].green = 0xA0A0; | |
4800 style->fg[GTK_STATE_NORMAL].blue = 0x4646; | |
4801 style->fg[GTK_STATE_ACTIVE] = style->fg[GTK_STATE_NORMAL]; | |
4359 | 4802 } |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
4803 else if (im != NULL && gaim_im_get_typing_state(im) == GAIM_TYPED) { |
4577 | 4804 style->fg[GTK_STATE_NORMAL].red = 0xD1D1; |
4805 style->fg[GTK_STATE_NORMAL].green = 0x9494; | |
4806 style->fg[GTK_STATE_NORMAL].blue = 0x0C0C; | |
4807 style->fg[GTK_STATE_ACTIVE] = style->fg[GTK_STATE_NORMAL]; | |
4359 | 4808 } |
4809 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_NICK) { | |
4577 | 4810 style->fg[GTK_STATE_ACTIVE].red = 0x3131; |
4811 style->fg[GTK_STATE_ACTIVE].green = 0x4E4E; | |
4812 style->fg[GTK_STATE_ACTIVE].blue = 0x6C6C; | |
4578 | 4813 style->fg[GTK_STATE_NORMAL] = style->fg[GTK_STATE_ACTIVE]; |
4359 | 4814 } |
4815 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_TEXT) { | |
4577 | 4816 style->fg[GTK_STATE_ACTIVE].red = 0xDFDF; |
4817 style->fg[GTK_STATE_ACTIVE].green = 0x4242; | |
4818 style->fg[GTK_STATE_ACTIVE].blue = 0x1E1E; | |
4578 | 4819 style->fg[GTK_STATE_NORMAL] = style->fg[GTK_STATE_ACTIVE]; |
4359 | 4820 } |
4821 | |
4822 gtk_widget_set_style(gtkconv->tab_label, style); | |
4635 | 4823 g_object_unref(G_OBJECT(style)); |
4736 | 4824 |
4812 | 4825 if(conv == gaim_window_get_active_conversation(win)) { |
4736 | 4826 update_typing_icon(conv); |
4827 } | |
4828 | |
4359 | 4829 } |
4830 else if (type == GAIM_CONV_UPDATE_TOPIC) { | |
4831 chat = GAIM_CHAT(conv); | |
4832 gtkchat = gtkconv->u.chat; | |
4833 | |
4834 gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), | |
4835 gaim_chat_get_topic(chat)); | |
4836 } | |
4837 else if (type == GAIM_CONV_ACCOUNT_ONLINE || | |
4838 type == GAIM_CONV_ACCOUNT_OFFLINE) { | |
4839 | |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
4840 generate_send_as_items(win, NULL); |
4359 | 4841 } |
4397
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4842 else if(type == GAIM_CONV_UPDATE_ADD || |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4843 type == GAIM_CONV_UPDATE_REMOVE) { |
4736 | 4844 |
4397
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4845 update_convo_add_button(conv); |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4846 } |
4359 | 4847 } |
4848 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4849 static GaimConversationUiOps conversation_ui_ops = |
4359 | 4850 { |
4851 gaim_gtkconv_destroy, /* destroy_conversation */ | |
4852 gaim_gtkconv_write_chat, /* write_chat */ | |
4853 gaim_gtkconv_write_im, /* write_im */ | |
4854 gaim_gtkconv_write_conv, /* write_conv */ | |
4855 gaim_gtkconv_chat_add_user, /* chat_add_user */ | |
4856 gaim_gtkconv_chat_rename_user, /* chat_rename_user */ | |
4857 gaim_gtkconv_chat_remove_user, /* chat_remove_user */ | |
4858 gaim_gtkconv_set_title, /* set_title */ | |
4859 NULL, /* update_progress */ | |
4860 gaim_gtkconv_updated /* updated */ | |
4861 }; | |
4862 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4863 GaimConversationUiOps * |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4864 gaim_get_gtk_conversation_ui_ops(void) |
4359 | 4865 { |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4866 return &conversation_ui_ops; |
4359 | 4867 } |
4868 | |
4869 /************************************************************************** | |
4870 * Public conversation utility functions | |
4871 **************************************************************************/ | |
4872 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4873 remove_icon(GaimGtkConversation *gtkconv) |
4359 | 4874 { |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
4875 g_return_if_fail(gtkconv != NULL); |
4359 | 4876 |
4877 if (gtkconv->u.im->icon != NULL) | |
4878 gtk_container_remove(GTK_CONTAINER(gtkconv->bbox), | |
4879 gtkconv->u.im->icon->parent->parent); | |
4880 | |
4881 if (gtkconv->u.im->anim != NULL) | |
4793 | 4882 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); |
4359 | 4883 |
4884 if (gtkconv->u.im->icon_timer != 0) | |
4885 g_source_remove(gtkconv->u.im->icon_timer); | |
4886 | |
4887 if (gtkconv->u.im->iter != NULL) | |
4888 g_object_unref(G_OBJECT(gtkconv->u.im->iter)); | |
4889 | |
4890 gtkconv->u.im->icon_timer = 0; | |
4891 gtkconv->u.im->icon = NULL; | |
4892 gtkconv->u.im->anim = NULL; | |
4893 gtkconv->u.im->iter = NULL; | |
4894 } | |
4895 | |
4896 static gboolean | |
4897 redraw_icon(gpointer data) | |
4898 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4899 GaimConversation *conv = (GaimConversation *)data; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4900 GaimGtkConversation *gtkconv; |
4359 | 4901 |
4902 GdkPixbuf *buf; | |
4903 GdkPixbuf *scale; | |
4904 GdkPixmap *pm; | |
4905 GdkBitmap *bm; | |
4906 gint delay; | |
4907 | |
4908 if (!g_list_find(gaim_get_ims(), conv)) { | |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
4909 gaim_debug(GAIM_DEBUG_WARNING, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
4910 "Conversation not found in redraw_icon. I think this " |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
4911 "is a bug.\n"); |
4359 | 4912 return FALSE; |
4913 } | |
4914 | |
4915 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4916 | |
4917 gdk_pixbuf_animation_iter_advance(gtkconv->u.im->iter, NULL); | |
4918 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); | |
4919 | |
4920 scale = gdk_pixbuf_scale_simple(buf, | |
4921 MAX(gdk_pixbuf_get_width(buf) * SCALE(gtkconv->u.im->anim) / | |
4922 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), | |
4923 MAX(gdk_pixbuf_get_height(buf) * SCALE(gtkconv->u.im->anim) / | |
4924 gdk_pixbuf_animation_get_height(gtkconv->u.im->anim), 1), | |
4925 GDK_INTERP_NEAREST); | |
4926 | |
4927 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); | |
4793 | 4928 g_object_unref(G_OBJECT(scale)); |
4635 | 4929 gtk_image_set_from_pixmap(GTK_IMAGE(gtkconv->u.im->icon), pm, bm); |
4793 | 4930 g_object_unref(G_OBJECT(pm)); |
4359 | 4931 gtk_widget_queue_draw(gtkconv->u.im->icon); |
4932 | |
4933 if (bm) | |
4793 | 4934 g_object_unref(G_OBJECT(bm)); |
4359 | 4935 |
4936 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter) / 10; | |
4937 | |
4938 gtkconv->u.im->icon_timer = g_timeout_add(delay * 10, redraw_icon, conv); | |
4939 | |
4940 return FALSE; | |
4941 } | |
4942 | |
4943 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4944 start_anim(GtkObject *obj, GaimConversation *conv) |
4359 | 4945 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4946 GaimGtkConversation *gtkconv; |
4359 | 4947 int delay; |
4948 | |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
4949 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
4359 | 4950 return; |
4951 | |
4952 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4953 | |
6016 | 4954 if (gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim)) |
4955 return; | |
4956 | |
4359 | 4957 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter) / 10; |
4958 | |
4959 if (gtkconv->u.im->anim) | |
4960 gtkconv->u.im->icon_timer = g_timeout_add(delay * 10, redraw_icon, | |
4961 conv); | |
4962 } | |
4963 | |
4964 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4965 stop_anim(GtkObject *obj, GaimConversation *conv) |
4359 | 4966 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4967 GaimGtkConversation *gtkconv; |
4359 | 4968 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
4969 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
4359 | 4970 return; |
4971 | |
4972 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4973 | |
4974 if (gtkconv->u.im->icon_timer != 0) | |
4975 g_source_remove(gtkconv->u.im->icon_timer); | |
4976 | |
4977 gtkconv->u.im->icon_timer = 0; | |
4978 } | |
4979 | |
4980 static gboolean | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4981 icon_menu(GtkObject *obj, GdkEventButton *e, GaimConversation *conv) |
4359 | 4982 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4983 GaimGtkConversation *gtkconv; |
4359 | 4984 static GtkWidget *menu = NULL; |
4985 GtkWidget *button; | |
4986 | |
4987 if (e->button != 3 || e->type != GDK_BUTTON_PRESS) | |
4988 return FALSE; | |
4989 | |
4990 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4991 | |
4992 /* | |
4993 * If a menu already exists, destroy it before creating a new one, | |
4994 * thus freeing-up the memory it occupied. | |
4995 */ | |
4996 if (menu != NULL) | |
4997 gtk_widget_destroy(menu); | |
4998 | |
4999 menu = gtk_menu_new(); | |
5000 | |
5001 if (gtkconv->u.im->icon_timer) { | |
5002 button = gtk_menu_item_new_with_label(_("Disable Animation")); | |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
5003 g_signal_connect(G_OBJECT(button), "activate", |
4359 | 5004 G_CALLBACK(stop_anim), conv); |
5005 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
5006 gtk_widget_show(button); | |
5007 } | |
5008 else if (gtkconv->u.im->anim && | |
5009 !(gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim))) | |
5010 { | |
5011 button = gtk_menu_item_new_with_label(_("Enable Animation")); | |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
5012 g_signal_connect(G_OBJECT(button), "activate", |
4359 | 5013 G_CALLBACK(start_anim), conv); |
5014 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
5015 gtk_widget_show(button); | |
5016 } | |
5017 | |
5018 button = gtk_menu_item_new_with_label(_("Hide Icon")); | |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
5019 g_signal_connect_swapped(G_OBJECT(button), "activate", |
4515
9b9737a00a96
[gaim-migrate @ 4793]
Christian Hammond <chipx86@chipx86.com>
parents:
4513
diff
changeset
|
5020 G_CALLBACK(remove_icon), gtkconv); |
4359 | 5021 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); |
5022 gtk_widget_show(button); | |
5023 | |
5024 button = gtk_menu_item_new_with_label(_("Save Icon As...")); | |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
5025 g_signal_connect(G_OBJECT(button), "activate", |
4359 | 5026 G_CALLBACK(gaim_gtk_save_icon_dialog), conv); |
5027 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
5028 gtk_widget_show(button); | |
5029 | |
5030 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, e->button, e->time); | |
5031 | |
5032 return TRUE; | |
5033 } | |
5034 | |
5035 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5036 gaim_gtkconv_update_buddy_icon(GaimConversation *conv) |
4359 | 5037 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5038 GaimGtkConversation *gtkconv; |
4359 | 5039 |
5040 char filename[256]; | |
5041 FILE *file; | |
5042 GError *err = NULL; | |
5462
8355eeeb52a3
[gaim-migrate @ 5853]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
5043 gboolean animate = TRUE; |
4359 | 5044 |
4757 | 5045 struct buddy *buddy; |
5046 | |
4359 | 5047 void *data; |
5048 int len, delay; | |
5049 | |
5050 GdkPixbuf *buf; | |
5051 | |
5052 GtkWidget *event; | |
5053 GtkWidget *frame; | |
5054 GdkPixbuf *scale; | |
5055 GdkPixmap *pm; | |
5056 GdkBitmap *bm; | |
5057 int sf = 0; | |
5058 | |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5059 g_return_if_fail(conv != NULL); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5060 g_return_if_fail(GAIM_IS_GTK_CONVERSATION(conv)); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5061 g_return_if_fail(gaim_conversation_get_type(conv) == GAIM_CONV_IM); |
4359 | 5062 |
5063 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5064 | |
5462
8355eeeb52a3
[gaim-migrate @ 5853]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
5065 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
|
5066 animate = FALSE; |
8355eeeb52a3
[gaim-migrate @ 5853]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
5067 |
4359 | 5068 remove_icon(gtkconv); |
5069 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5070 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/im/show_buddy_icons")) |
4359 | 5071 return; |
5072 | |
5073 if (gaim_conversation_get_gc(conv) == NULL) | |
5074 return; | |
5075 | |
4793 | 5076 if(gtkconv->u.im->anim) |
5077 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); | |
5078 | |
4757 | 5079 if((buddy = gaim_find_buddy(gaim_conversation_get_account(conv), |
5080 gaim_conversation_get_name(conv))) != NULL) { | |
5081 char *file = gaim_buddy_get_setting(buddy, "buddy_icon"); | |
5082 if(file) { | |
5083 gtkconv->u.im->anim = gdk_pixbuf_animation_new_from_file(file, &err); | |
5084 g_free(file); | |
5085 } | |
5086 } else { | |
5087 data = get_icon_data(gaim_conversation_get_gc(conv), | |
5088 normalize(gaim_conversation_get_name(conv)), | |
5089 &len); | |
5090 | |
5091 if (!data) | |
5092 return; | |
5093 | |
5094 /* this is such an evil hack, i don't know why i'm even considering it. | |
5095 * we'll do it differently when gdk-pixbuf-loader isn't leaky anymore. */ | |
5096 g_snprintf(filename, sizeof(filename), | |
5097 "%s" G_DIR_SEPARATOR_S "gaimicon-%s.%d", | |
5098 g_get_tmp_dir(), gaim_conversation_get_name(conv), getpid()); | |
5099 | |
5100 if (!(file = fopen(filename, "wb"))) | |
5101 return; | |
5102 | |
5103 fwrite(data, 1, len, file); | |
5104 fclose(file); | |
5105 | |
5106 gtkconv->u.im->anim = gdk_pixbuf_animation_new_from_file(filename, &err); | |
5107 /* make sure we remove the file as soon as possible */ | |
5108 unlink(filename); | |
5109 } | |
4359 | 5110 |
5111 if (err) { | |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5112 gaim_debug(GAIM_DEBUG_ERROR, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5113 "Buddy icon error: %s\n", err->message); |
4359 | 5114 g_error_free(err); |
5115 } | |
5116 | |
5117 | |
5118 if (!gtkconv->u.im->anim) | |
5119 return; | |
5120 | |
4793 | 5121 if(gtkconv->u.im->iter) |
5122 g_object_unref(G_OBJECT(gtkconv->u.im->iter)); | |
5123 | |
4359 | 5124 if (gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim)) { |
5125 gtkconv->u.im->iter = NULL; | |
5126 delay = 0; | |
5127 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); | |
5128 } else { | |
5129 gtkconv->u.im->iter = | |
5130 gdk_pixbuf_animation_get_iter(gtkconv->u.im->anim, NULL); | |
5131 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); | |
5132 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter); | |
5133 delay = delay / 10; | |
5134 } | |
5135 | |
5136 sf = SCALE(gtkconv->u.im->anim); | |
5137 scale = gdk_pixbuf_scale_simple(buf, | |
5138 MAX(gdk_pixbuf_get_width(buf) * sf / | |
5139 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), | |
5140 MAX(gdk_pixbuf_get_height(buf) * sf / | |
5141 gdk_pixbuf_animation_get_height(gtkconv->u.im->anim), 1), | |
5142 GDK_INTERP_NEAREST); | |
5143 | |
5144 if (delay) | |
5145 gtkconv->u.im->icon_timer = g_timeout_add(delay * 10, redraw_icon, | |
5146 conv); | |
5147 | |
5148 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); | |
4793 | 5149 g_object_unref(G_OBJECT(scale)); |
4359 | 5150 |
5151 frame = gtk_frame_new(NULL); | |
5152 gtk_frame_set_shadow_type(GTK_FRAME(frame), | |
5153 (bm ? GTK_SHADOW_NONE : GTK_SHADOW_IN)); | |
5154 gtk_box_pack_start(GTK_BOX(gtkconv->bbox), frame, FALSE, FALSE, 5); | |
5155 gtk_box_reorder_child(GTK_BOX(gtkconv->bbox), frame, 0); | |
5156 gtk_widget_show(frame); | |
5157 | |
5158 event = gtk_event_box_new(); | |
5159 gtk_container_add(GTK_CONTAINER(frame), event); | |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
5160 g_signal_connect(G_OBJECT(event), "button-press-event", |
4359 | 5161 G_CALLBACK(icon_menu), conv); |
5162 gtk_widget_show(event); | |
5163 | |
4635 | 5164 gtkconv->u.im->icon = gtk_image_new_from_pixmap(pm, bm); |
4359 | 5165 gtk_widget_set_size_request(gtkconv->u.im->icon, sf, sf); |
5166 gtk_container_add(GTK_CONTAINER(event), gtkconv->u.im->icon); | |
5167 gtk_widget_show(gtkconv->u.im->icon); | |
5168 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5169 if (!animate || |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5170 !gaim_prefs_get_bool("/gaim/gtk/conversations/im/animate_buddy_icons")) { |
4359 | 5171 stop_anim(NULL, conv); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5172 } |
4359 | 5173 |
4793 | 5174 g_object_unref(G_OBJECT(pm)); |
4359 | 5175 |
5176 if (bm) | |
4793 | 5177 g_object_unref(G_OBJECT(bm)); |
4359 | 5178 } |
5179 | |
5180 void | |
5181 gaim_gtkconv_update_font_buttons(void) | |
5182 { | |
5183 GList *l; | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5184 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5185 GaimGtkConversation *gtkconv; |
4359 | 5186 |
5187 for (l = gaim_get_ims(); l != NULL; l = l->next) { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5188 conv = (GaimConversation *)l->data; |
4359 | 5189 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5190 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
4359 | 5191 continue; |
5192 | |
5193 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5194 | |
5195 if (gtkconv->toolbar.bold != NULL) | |
5196 gtk_widget_set_sensitive(gtkconv->toolbar.bold, | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5197 !gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold")); |
4359 | 5198 |
5199 if (gtkconv->toolbar.italic != NULL) | |
5200 gtk_widget_set_sensitive(gtkconv->toolbar.italic, | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5201 !gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic")); |
4359 | 5202 |
5203 if (gtkconv->toolbar.underline != NULL) | |
5204 gtk_widget_set_sensitive(gtkconv->toolbar.underline, | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5205 !gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline")); |
4359 | 5206 } |
5207 } | |
5208 | |
5209 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5210 gaim_gtkconv_update_font_colors(GaimConversation *conv) |
4421 | 5211 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5212 GaimGtkConversation *gtkconv; |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5213 |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5214 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5215 return; |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5216 |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5217 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5218 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5219 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5220 >kconv->fg_color); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5221 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5222 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5223 >kconv->bg_color); |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5224 } |
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 void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5227 gaim_gtkconv_update_font_face(GaimConversation *conv) |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5228 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5229 GaimGtkConversation *gtkconv; |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5230 |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5231 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5232 return; |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5233 |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5234 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
5235 |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5236 strncpy(gtkconv->fontface, fontface, 128); |
4421 | 5237 } |
5238 | |
5239 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5240 gaim_gtkconv_update_buttons_by_protocol(GaimConversation *conv) |
4359 | 5241 { |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
5242 GaimPluginProtocolInfo *prpl_info = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5243 GaimWindow *win; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5244 GaimGtkWindow *gtkwin = NULL; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5245 GaimGtkConversation *gtkconv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
5246 GaimConnection *gc; |
4359 | 5247 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5248 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
4359 | 5249 return; |
5250 | |
5251 gc = gaim_conversation_get_gc(conv); | |
5252 win = gaim_conversation_get_window(conv); | |
5253 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5254 | |
5255 if (win != NULL) | |
5256 gtkwin = GAIM_GTK_WINDOW(win); | |
5257 | |
5258 if (gc == NULL) { | |
5259 gtk_widget_set_sensitive(gtkconv->send, FALSE); | |
5260 | |
4365
6e96ced6fb78
[gaim-migrate @ 4631]
Christian Hammond <chipx86@chipx86.com>
parents:
4364
diff
changeset
|
5261 if (win != NULL && gaim_window_get_active_conversation(win) == conv) { |
4359 | 5262 gtk_widget_set_sensitive(gtkwin->menu.insert_link, FALSE); |
5263 } | |
5264 } | |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
5265 else { |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
5266 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
5267 |
4674 | 5268 gtk_widget_set_sensitive(gtkconv->send, TRUE); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5269 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5270 if (win != NULL) |
4365
6e96ced6fb78
[gaim-migrate @ 4631]
Christian Hammond <chipx86@chipx86.com>
parents:
4364
diff
changeset
|
5271 gtk_widget_set_sensitive(gtkwin->menu.insert_link, TRUE); |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
5272 } |
4359 | 5273 |
5274 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
5275 if (gc == NULL) { | |
5276 gtk_widget_set_sensitive(gtkconv->info, FALSE); | |
5277 gtk_widget_set_sensitive(gtkconv->u.im->warn, FALSE); | |
5278 gtk_widget_set_sensitive(gtkconv->u.im->block, FALSE); | |
5279 gtk_widget_set_sensitive(gtkconv->u.im->add, FALSE); | |
5280 | |
5281 if (win != NULL && | |
5282 gaim_window_get_active_conversation(win) == conv) { | |
5283 | |
5284 gtk_widget_set_sensitive(gtkwin->menu.insert_image, FALSE); | |
5285 } | |
5286 | |
5287 return; | |
5288 } | |
5289 | |
5290 gtk_widget_set_sensitive(gtkconv->info, | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
5291 (prpl_info->get_info != NULL)); |
4359 | 5292 |
5293 gtk_widget_set_sensitive(gtkconv->toolbar.image, | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
5294 (prpl_info->options & OPT_PROTO_IM_IMAGE)); |
4359 | 5295 |
5296 if (win != NULL && gaim_window_get_active_conversation(win) == conv) { | |
5297 gtk_widget_set_sensitive(gtkwin->menu.insert_image, | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
5298 (prpl_info->options & OPT_PROTO_IM_IMAGE)); |
4359 | 5299 } |
5300 | |
5301 gtk_widget_set_sensitive(gtkconv->u.im->warn, | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
5302 (prpl_info->warn != NULL)); |
4359 | 5303 |
5304 gtk_widget_set_sensitive(gtkconv->u.im->block, | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
5305 (prpl_info->add_permit != NULL)); |
4359 | 5306 |
5307 update_convo_add_button(conv); | |
5308 } | |
5309 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
5310 if (gc == NULL) { | |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5311 if (gtkconv->u.chat->whisper != NULL) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5312 gtk_widget_set_sensitive(gtkconv->u.chat->whisper, FALSE); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5313 |
4359 | 5314 gtk_widget_set_sensitive(gtkconv->u.chat->invite, FALSE); |
5315 | |
5316 return; | |
5317 } | |
5318 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
5319 gtk_widget_set_sensitive(gtkconv->send, (prpl_info->chat_send != NULL)); |
4359 | 5320 |
5321 gtk_widget_set_sensitive(gtkconv->toolbar.image, FALSE); | |
5322 /* gtk_widget_set_sensitive(gtkwin->menu.insert_image, FALSE); */ | |
5323 | |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5324 if (gtkconv->u.chat->whisper != NULL) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5325 gtk_widget_set_sensitive(gtkconv->u.chat->whisper, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5326 (prpl_info->chat_whisper != NULL)); |
4359 | 5327 |
5328 gtk_widget_set_sensitive(gtkconv->u.chat->invite, | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
5329 (prpl_info->chat_invite != NULL)); |
4359 | 5330 } |
5331 } | |
5332 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5333 GaimWindow * |
4359 | 5334 gaim_gtkwin_get_at_xy(int x, int y) |
5335 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5336 GaimWindow *win = NULL; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5337 GaimGtkWindow *gtkwin; |
4359 | 5338 GdkWindow *gdkwin; |
5339 GList *l; | |
5340 | |
5341 gdkwin = gdk_window_at_pointer(&x, &y); | |
5342 | |
5343 if (gdkwin) | |
5344 gdkwin = gdk_window_get_toplevel(gdkwin); | |
5345 | |
5346 for (l = gaim_get_windows(); l != NULL; l = l->next) { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5347 win = (GaimWindow *)l->data; |
4359 | 5348 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5349 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5350 continue; |
5351 | |
5352 gtkwin = GAIM_GTK_WINDOW(win); | |
5353 | |
5354 if (gdkwin == gtkwin->window->window) | |
5355 return win; | |
5356 } | |
5357 | |
5358 return NULL; | |
5359 } | |
5360 | |
5361 int | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5362 gaim_gtkconv_get_tab_at_xy(GaimWindow *win, int x, int y) |
4359 | 5363 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5364 GaimGtkWindow *gtkwin; |
4359 | 5365 GList *l; |
5366 gint nb_x, nb_y, x_rel, y_rel; | |
5367 GtkNotebook *notebook; | |
5368 GtkWidget *tab; | |
5369 gint i, page_num = 0; | |
5370 gboolean first_visible = TRUE; | |
5371 | |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5372 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5373 return -1; |
5374 | |
5375 gtkwin = GAIM_GTK_WINDOW(win); | |
5376 notebook = GTK_NOTEBOOK(gtkwin->notebook); | |
5377 | |
5378 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
5379 x_rel = x - nb_x; | |
5380 y_rel = y - nb_y; | |
5381 | |
5382 for (l = gaim_window_get_conversations(win), i = 0; | |
5383 l != NULL; | |
5384 l = l->next, i++) { | |
5385 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5386 GaimConversation *conv = l->data; |
4359 | 5387 tab = GAIM_GTK_CONVERSATION(conv)->tab_label; |
5388 | |
5389 if (!GTK_WIDGET_MAPPED(tab)) | |
5390 continue; | |
5391 | |
5392 if (first_visible) { | |
5393 first_visible = FALSE; | |
5394 | |
5395 if (x_rel < tab->allocation.x) x_rel = tab->allocation.x; | |
5396 if (y_rel < tab->allocation.y) y_rel = tab->allocation.y; | |
5397 } | |
5398 | |
5399 if (gtk_notebook_get_tab_pos(notebook) == GTK_POS_TOP || | |
5400 gtk_notebook_get_tab_pos(notebook) == GTK_POS_BOTTOM) { | |
5401 | |
5402 if (tab->allocation.x <= x_rel) { | |
5403 if (tab->allocation.x + tab->allocation.width <= x_rel) | |
5404 page_num = i + 1; | |
5405 else | |
5406 page_num = i; | |
5407 } | |
5408 else | |
5409 break; | |
5410 } | |
5411 else { | |
5412 if (tab->allocation.y <= y_rel) { | |
5413 if (tab->allocation.y + tab->allocation.height <= y_rel) | |
5414 page_num = i + 1; | |
5415 else | |
5416 page_num = i; | |
5417 } | |
5418 else | |
5419 break; | |
5420 } | |
5421 } | |
5422 | |
5423 if (i == gaim_window_get_conversation_count(win) + 1) | |
5424 return -1; | |
5425 | |
5426 return page_num; | |
5427 } | |
5428 | |
5429 int | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5430 gaim_gtkconv_get_dest_tab_at_xy(GaimWindow *win, int x, int y) |
4359 | 5431 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5432 GaimGtkWindow *gtkwin; |
4359 | 5433 GList *l; |
5434 gint nb_x, nb_y, x_rel, y_rel; | |
5435 GtkNotebook *notebook; | |
5436 GtkWidget *tab; | |
5437 gint i, page_num = 0; | |
5438 | |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5439 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5440 return -1; |
5441 | |
5442 gtkwin = GAIM_GTK_WINDOW(win); | |
5443 notebook = GTK_NOTEBOOK(gtkwin->notebook); | |
5444 | |
5445 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
5446 x_rel = x - nb_x; | |
5447 y_rel = y - nb_y; | |
5448 | |
5449 for (l = gaim_window_get_conversations(win), i = 0; | |
5450 l != NULL; | |
5451 l = l->next, i++) { | |
5452 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5453 GaimConversation *conv = l->data; |
4359 | 5454 tab = GAIM_GTK_CONVERSATION(conv)->tab_label; |
5455 | |
5456 if (!GTK_WIDGET_MAPPED(tab)) | |
5457 continue; | |
5458 | |
5459 if (gtk_notebook_get_tab_pos(notebook) == GTK_POS_TOP || | |
5460 gtk_notebook_get_tab_pos(notebook) == GTK_POS_BOTTOM) { | |
5461 | |
5462 if (tab->allocation.x <= x_rel) { | |
5463 if (tab->allocation.x + (tab->allocation.width / 2) <= x_rel) | |
5464 page_num = i + 1; | |
5465 else | |
5466 page_num = i; | |
5467 } | |
5468 else | |
5469 break; | |
5470 } | |
5471 else { | |
5472 if (tab->allocation.y <= y_rel) { | |
5473 if (tab->allocation.y + (tab->allocation.height / 2) <= y_rel) | |
5474 page_num = i + 1; | |
5475 else | |
5476 page_num = i; | |
5477 } | |
5478 else | |
5479 break; | |
5480 } | |
5481 } | |
5482 | |
5483 if (i == gaim_window_get_conversation_count(win) + 1) | |
5484 return -1; | |
5485 | |
5486 return page_num; | |
5487 } | |
4940
3708545afe42
[gaim-migrate @ 5274]
Christian Hammond <chipx86@chipx86.com>
parents:
4939
diff
changeset
|
5488 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5489 static void |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5490 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
|
5491 gpointer data) |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5492 { |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5493 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5494 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5495 GaimGtkConversation *gtkconv; |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5496 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5497 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5498 conv = (GaimConversation *)l->data; |
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 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5501 continue; |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5502 |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5503 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5504 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5505 if (value) |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5506 gtk_widget_show(gtkconv->close); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5507 else |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5508 gtk_widget_hide(gtkconv->close); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5509 } |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5510 } |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5511 |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5512 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5513 show_timestamps_pref_cb(const char *name, GaimPrefType type, gpointer value, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5514 gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5515 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5516 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5517 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5518 GaimGtkConversation *gtkconv; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5519 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5520 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5521 conv = (GaimConversation *)l->data; |
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 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5524 continue; |
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 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5527 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5528 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), (gboolean)value); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5529 } |
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 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5532 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5533 spellcheck_pref_cb(const char *name, GaimPrefType type, gpointer value, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5534 gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5535 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5536 #ifdef USE_GTKSPELL |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5537 GList *cl; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5538 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5539 GaimGtkConversation *gtkconv; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5540 GtkSpell *spell; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5541 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5542 for (cl = gaim_get_conversations(); cl != NULL; cl = cl->next) { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5543 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5544 conv = (GaimConversation *)cl->data; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5545 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5546 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5547 continue; |
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 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5550 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5551 if (value) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5552 gtkspell_new_attach(GTK_TEXT_VIEW(gtkconv->entry), NULL, NULL); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5553 else { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5554 spell = gtkspell_get_from_text_view(GTK_TEXT_VIEW(gtkconv->entry)); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5555 gtkspell_detach(spell); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5556 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5557 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5558 #endif |
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 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5562 show_smileys_pref_cb(const char *name, GaimPrefType type, gpointer value, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5563 gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5564 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5565 GList *cl; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5566 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5567 GaimGtkConversation *gtkconv; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5568 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5569 for (cl = gaim_get_conversations(); cl != NULL; cl = cl->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5570 conv = (GaimConversation *)cl->data; |
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 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5573 continue; |
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 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5576 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5577 gtk_imhtml_show_smileys(GTK_IMHTML(gtkconv->imhtml), (gboolean)value); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5578 } |
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 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5581 static void |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5582 tab_side_pref_cb(const char *name, GaimPrefType type, gpointer value, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5583 gpointer data) |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5584 { |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5585 GList *l; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5586 GtkPositionType pos; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5587 GaimWindow *win; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5588 GaimGtkWindow *gtkwin; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5589 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5590 pos = GPOINTER_TO_INT(value); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5591 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5592 for (l = gaim_get_windows(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5593 win = (GaimWindow *)l->data; |
5675
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 if (!GAIM_IS_GTK_WINDOW(win)) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5596 continue; |
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 gtkwin = GAIM_GTK_WINDOW(win); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5599 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5600 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5601 } |
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 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5604 static void |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5605 im_button_type_pref_cb(const char *name, GaimPrefType type, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5606 gpointer value, gpointer data) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5607 { |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5608 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5609 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5610 GaimGtkConversation *gtkconv; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5611 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5612 for (l = gaim_get_ims(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5613 conv = (GaimConversation *)l->data; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5614 gtkconv = GAIM_GTK_CONVERSATION(conv); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5615 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5616 setup_im_buttons(conv, gtk_widget_get_parent(gtkconv->send)); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5617 } |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5618 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5619 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5620 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5621 animate_buddy_icons_pref_cb(const char *name, GaimPrefType type, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5622 gpointer value, gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5623 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5624 GList *l; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5625 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5626 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
|
5627 return; |
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 (value) { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5630 for (l = gaim_get_ims(); l != NULL; l = l->next) |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5631 start_anim(NULL, (GaimConversation *)l->data); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5632 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5633 else { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5634 for (l = gaim_get_ims(); l != NULL; l = l->next) |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5635 stop_anim(NULL, (GaimConversation *)l->data); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5636 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5637 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5638 |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5639 static void |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5640 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
|
5641 gpointer data) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5642 { |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5643 GList *l; |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5644 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5645 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5646 GaimConversation *conv = l->data; |
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 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5649 gaim_conversation_foreach(gaim_gtkconv_update_buddy_icon); |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5650 } |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5651 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5652 |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5680
diff
changeset
|
5653 static void |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5654 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
|
5655 gpointer data) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5656 { |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5657 GList *l; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5658 GaimConnection *g; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5659 GtkWidget *parent; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5660 GaimConversationType conv_type = GAIM_CONV_CHAT; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5661 GSList *bcs; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5662 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5663 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5664 GaimGtkWindow *gtkwin; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5665 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5666 for (l = gaim_connections_get_all(); l != NULL; l = l->next) { |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5667 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5668 g = (GaimConnection *)l->data; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5669 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5670 for (bcs = g->buddy_chats; bcs != NULL; bcs = bcs->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5671 conv = (GaimConversation *)bcs->data; |
5675
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 if (gaim_conversation_get_type(conv) != GAIM_CONV_CHAT) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5674 continue; |
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_IS_GTK_CONVERSATION(conv)) |
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 gtkconv = GAIM_GTK_CONVERSATION(conv); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5680 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5681 parent = gtk_widget_get_parent(gtkconv->send); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5682 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5683 gtkconv->send = |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5684 gaim_gtk_change_text(_("Send"), |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5685 gtkconv->send, GAIM_STOCK_SEND, conv_type); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5686 gtkconv->u.chat->invite = |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5687 gaim_gtk_change_text(_("Invite"), |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5688 gtkconv->u.chat->invite, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5689 GAIM_STOCK_INVITE, conv_type); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5690 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5691 gtk_box_pack_end(GTK_BOX(parent), gtkconv->send, FALSE, FALSE, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5692 conv_type); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5693 gtk_box_pack_end(GTK_BOX(parent), gtkconv->u.chat->invite, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5694 FALSE, FALSE, 0); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5695 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5696 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->send, 0); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5697 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5698 g_signal_connect(G_OBJECT(gtkconv->send), "clicked", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5699 G_CALLBACK(send_cb), conv); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5700 g_signal_connect(G_OBJECT(gtkconv->u.chat->invite), "clicked", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5701 G_CALLBACK(invite_cb), conv); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5702 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5703 gtk_button_set_relief(GTK_BUTTON(gtkconv->send), |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5704 GTK_RELIEF_NONE); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5705 gtk_button_set_relief(GTK_BUTTON(gtkconv->u.chat->invite), |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5706 GTK_RELIEF_NONE); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5707 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5708 gaim_gtkconv_update_buttons_by_protocol(conv); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5709 } |
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 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5712 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5713 void |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5714 gaim_gtk_conversation_init(void) |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5715 { |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5716 /* Conversations */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5717 gaim_prefs_add_none("/gaim/gtk/conversations"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5718 gaim_prefs_add_bool("/gaim/gtk/conversations/close_on_tabs", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5719 gaim_prefs_add_bool("/gaim/gtk/conversations/ctrl_enter_sends", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5720 gaim_prefs_add_bool("/gaim/gtk/conversations/enter_sends", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5721 gaim_prefs_add_bool("/gaim/gtk/conversations/escape_closes", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5722 gaim_prefs_add_bool("/gaim/gtk/conversations/send_bold", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5723 gaim_prefs_add_bool("/gaim/gtk/conversations/send_italic", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5724 gaim_prefs_add_bool("/gaim/gtk/conversations/send_strikethrough", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5725 gaim_prefs_add_bool("/gaim/gtk/conversations/send_underline", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5726 gaim_prefs_add_bool("/gaim/gtk/conversations/show_smileys", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5727 gaim_prefs_add_bool("/gaim/gtk/conversations/show_timestamps", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5728 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
|
5729 gaim_prefs_add_bool("/gaim/gtk/conversations/spellcheck", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5730 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_colors", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5731 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_fonts", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5732 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_font_sizes", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5733 gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_bgcolor", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5734 gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_fgcolor", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5735 gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_font", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5736 gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_size", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5737 gaim_prefs_add_bool("/gaim/gtk/conversations/html_shortcuts", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5738 gaim_prefs_add_bool("/gaim/gtk/conversations/smiley_shortcuts", FALSE); |
5743
af159a5bbaa0
[gaim-migrate @ 6167]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
5739 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
|
5740 gaim_prefs_add_string("/gaim/gtk/conversations/bgcolor", "#FFFFFF"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5741 gaim_prefs_add_string("/gaim/gtk/conversations/fgcolor", "#000000"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5742 gaim_prefs_add_string("/gaim/gtk/conversations/font_face", ""); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5743 gaim_prefs_add_int("/gaim/gtk/conversations/font_size", 3); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5744 gaim_prefs_add_bool("/gaim/gtk/conversations/tabs", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5745 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
|
5746 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5747 /* Conversations -> Chat */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5748 gaim_prefs_add_none("/gaim/gtk/conversations/chat"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5749 gaim_prefs_add_int("/gaim/gtk/conversations/chat/button_type", |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5750 GAIM_BUTTON_TEXT_IMAGE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5751 gaim_prefs_add_bool("/gaim/gtk/conversations/chat/color_nicks", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5752 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
|
5753 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
|
5754 gaim_prefs_add_bool("/gaim/gtk/conversations/chat/tab_completion", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5755 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_width", 410); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5756 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_height", 160); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5757 gaim_prefs_add_int("/gaim/gtk/conversations/chat/entry_height", 50); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5758 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5759 /* Conversations -> IM */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5760 gaim_prefs_add_none("/gaim/gtk/conversations/im"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5761 gaim_prefs_add_int("/gaim/gtk/conversations/im/button_type", |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5762 GAIM_BUTTON_TEXT_IMAGE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5763 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
|
5764 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
|
5765 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
|
5766 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
|
5767 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_width", 410); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5768 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_height", 160); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5769 gaim_prefs_add_int("/gaim/gtk/conversations/im/entry_height", 50); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5770 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5771 /* Connect callbacks. */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5772 gaim_prefs_connect_callback("/gaim/gtk/conversations/close_on_tabs", |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5773 close_on_tabs_pref_cb, NULL); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5774 gaim_prefs_connect_callback("/gaim/gtk/conversations/show_smileys", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5775 show_smileys_pref_cb, NULL); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5776 gaim_prefs_connect_callback("/gaim/gtk/conversations/show_timestamps", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5777 show_timestamps_pref_cb, NULL); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5778 gaim_prefs_connect_callback("/gaim/gtk/conversations/spellcheck", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5779 spellcheck_pref_cb, NULL); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5780 gaim_prefs_connect_callback("/gaim/gtk/conversations/tab_side", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5781 tab_side_pref_cb, NULL); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5782 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5783 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5784 /* IM callbacks */ |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5785 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/button_type", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5786 im_button_type_pref_cb, NULL); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5787 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/animate_buddy_icons", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5788 animate_buddy_icons_pref_cb, NULL); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5789 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/show_buddy_icons", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5790 show_buddy_icons_pref_cb, NULL); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5791 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5792 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5793 /* Chat callbacks */ |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5794 gaim_prefs_connect_callback("/gaim/gtk/conversations/chat/button_type", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5795 chat_button_type_pref_cb, NULL); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5796 } |