Mercurial > pidgin.yaz
annotate src/gtkconv.c @ 6174:8293762bdc27
[gaim-migrate @ 6659]
I'm in favor of releasing 0.66 as soon as the account proxy importing
thing is fixed.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Thu, 17 Jul 2003 05:28:21 +0000 |
parents | 387221e0623f |
children | 3b5c86808a66 |
rev | line source |
---|---|
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
1 /** |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
2 * @file gtkconv.h GTK+ Conversation API |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
3 * @ingroup gtkui |
4359 | 4 * |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
5 * Copyright (C) 2002-2003 Christian Hammond <chipx86@gnupdate.org> |
4359 | 6 * |
7 * This program is free software; you can redistribute it and/or modify | |
8 * it under the terms of the GNU General Public License as published by | |
9 * the Free Software Foundation; either version 2 of the License, or | |
10 * (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, | |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 * GNU General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU General Public License | |
18 * along with this program; if not, write to the Free Software | |
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
20 * | |
21 */ | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
22 #include "internal.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
23 |
4359 | 24 #ifndef _WIN32 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
25 # include <X11/Xlib.h> |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
26 #endif |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
27 |
4359 | 28 #ifdef USE_GTKSPELL |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
29 # include <gtkspell/gtkspell.h> |
4359 | 30 #endif |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
31 |
4359 | 32 #include <gdk/gdkkeysyms.h> |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
33 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
34 #include "debug.h" |
6115
11bedb793a44
[gaim-migrate @ 6578]
Christian Hammond <chipx86@chipx86.com>
parents:
6102
diff
changeset
|
35 #include "html.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
36 #include "log.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
37 #include "multi.h" |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5402
diff
changeset
|
38 #include "notify.h" |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
39 #include "prefs.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
40 #include "prpl.h" |
6038 | 41 #include "request.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
42 #include "sound.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
43 #include "util.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
44 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
45 #include "dnd-hints.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
46 #include "gtkblist.h" |
5717 | 47 #include "gtkconv.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
48 #include "gtkimhtml.h" |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
49 #include "gtkpounce.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
50 #include "gtkutils.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
51 #include "stock.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
52 |
5717 | 53 #include "ui.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
54 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
55 /* XXX */ |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
56 #include "gaim.h" |
4359 | 57 |
4373
dcc6c130c6d9
[gaim-migrate @ 4639]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4370
diff
changeset
|
58 #ifdef _WIN32 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
59 # include "wspell.h" |
4373
dcc6c130c6d9
[gaim-migrate @ 4639]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4370
diff
changeset
|
60 #endif |
dcc6c130c6d9
[gaim-migrate @ 4639]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4370
diff
changeset
|
61 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
62 #define AUTO_RESPONSE "<AUTO-REPLY> : " |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
63 |
4359 | 64 static char nick_colors[][8] = { |
65 "#ba55d3", /* Medium Orchid */ | |
66 "#ee82ee", /* Violet */ | |
67 "#c715b4", /* Medium Violet Red */ | |
68 "#ff69b4", /* Hot Pink */ | |
69 "#ff6347", /* Tomato */ | |
70 "#fa8c00", /* Dark Orange */ | |
71 "#fa8072", /* Salmon */ | |
72 "#b22222", /* Fire Brick */ | |
73 "#f4a460", /* Sandy Brown */ | |
74 "#cd5c5c", /* Indian Red */ | |
75 "#bc8f8f", /* Rosy Brown */ | |
76 "#f0e68c", /* Khaki */ | |
77 "#bdb76b", /* Dark Khaki */ | |
78 "#228b22", /* Forest Green */ | |
79 "#9acd32", /* Yellow Green */ | |
80 "#32cd32", /* Lime Green */ | |
81 "#3cb371", /* Medium Sea Green */ | |
82 "#2e8b57", /* Sea Green */ | |
83 "#8fbc8f", /* Dark Sea Green */ | |
84 "#66cdaa", /* Medium Aquamarine */ | |
85 "#5f9ea0", /* Cadet Blue */ | |
86 "#48d1cc", /* Medium Turquoise */ | |
87 "#00ced1", /* Dark Turquoise */ | |
88 "#4682b4", /* Stell Blue */ | |
89 "#00bfff", /* Deep Sky Blue */ | |
90 "#1690ff", /* Dodger Blue */ | |
91 "#4169ff", /* Royal Blue */ | |
92 "#6a5acd", /* Slate Blue */ | |
93 "#6495ed", /* Cornflower Blue */ | |
94 "#708090", /* Slate gray */ | |
95 "#ffdead", /* Navajo White */ | |
96 }; | |
97 #define NUM_NICK_COLORS (sizeof(nick_colors) / sizeof(*nick_colors)) | |
98 | |
99 #define SCALE(x) \ | |
100 ((gdk_pixbuf_animation_get_width(x) <= 48 && \ | |
101 gdk_pixbuf_animation_get_height(x) <= 48) ? 48 : 50) | |
102 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
103 typedef struct |
4359 | 104 { |
105 GtkWidget *window; | |
106 | |
107 GtkWidget *entry; | |
108 GtkWidget *message; | |
109 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
110 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
111 |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
112 } InviteBuddyInfo; |
4359 | 113 |
114 static GtkWidget *invite_dialog = NULL; | |
115 | |
116 /* Prototypes. <-- because Paco-Paco hates this comment. */ | |
117 static void check_everything(GtkTextBuffer *buffer); | |
4685 | 118 static void set_toggle(GtkWidget *tb, gboolean active); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
119 static void move_next_tab(GaimConversation *conv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
120 static void do_bold(GtkWidget *bold, GaimGtkConversation *gtkconv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
121 static void do_italic(GtkWidget *italic, GaimGtkConversation *gtkconv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
122 static void do_underline(GtkWidget *underline, GaimGtkConversation *gtkconv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
123 static void do_small(GtkWidget *small, GaimGtkConversation *gtkconv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
124 static void do_normal(GtkWidget *small, GaimGtkConversation *gtkconv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
125 static void do_big(GtkWidget *small, GaimGtkConversation *gtkconv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
126 static void toggle_font(GtkWidget *font, GaimConversation *conv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
127 static void toggle_fg_color(GtkWidget *color, GaimConversation *conv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
128 static void toggle_bg_color(GtkWidget *color, GaimConversation *conv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
129 static void got_typing_keypress(GaimConversation *conv, gboolean first); |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
130 static GList *generate_invite_user_names(GaimConnection *gc); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
131 static void add_chat_buddy_common(GaimConversation *conv, |
4359 | 132 const char *name, int pos); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
133 static void tab_complete(GaimConversation *conv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
134 static void update_typing_icon(GaimConversation *conv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
135 static gboolean update_send_as_selection(GaimWindow *win); |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
136 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
|
137 static void save_convo(GtkWidget *save, GaimConversation *c); |
4359 | 138 |
139 /************************************************************************** | |
140 * Callbacks | |
141 **************************************************************************/ | |
142 static void | |
6038 | 143 do_save_convo(GtkWidget *wid) |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
144 { |
6039 | 145 GaimConversation *c = g_object_get_data(G_OBJECT(GTK_FILE_SELECTION(wid)->ok_button), |
6038 | 146 "gaim_conversation"); |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
147 const char *filename; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
148 FILE *fp; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
149 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
150 filename = gtk_file_selection_get_filename(GTK_FILE_SELECTION(wid)); |
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 if (!((gaim_conversation_get_type(c) != GAIM_CONV_CHAT && |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
153 g_list_find(gaim_get_ims(), c)) || |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
154 (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_chats(), c)))) |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
156 filename = NULL; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
157 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
158 gtk_widget_destroy(wid); |
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 if (filename == NULL) |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
161 return; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
162 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
163 if ((fp = fopen(filename, "w+")) == NULL) |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
164 return; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
165 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
166 fprintf(fp, "%s", c->history->str); |
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 fclose(fp); |
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 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
171 static void |
6038 | 172 do_check_save_convo(GObject *obj, GtkWidget *wid) |
173 { | |
174 const char *filename = gtk_file_selection_get_filename(GTK_FILE_SELECTION(wid)); | |
175 | |
176 if (gaim_gtk_check_if_dir(filename, GTK_FILE_SELECTION(wid))) | |
177 return; | |
178 | |
179 if(g_file_test(filename, G_FILE_TEST_EXISTS)){ | |
180 gaim_request_yes_no(NULL, NULL, _("That file already exists"), | |
181 _("Would you like to overwrite it?"), 1, wid, | |
182 G_CALLBACK(do_save_convo), NULL); | |
183 } | |
184 else | |
185 do_save_convo(wid); | |
186 } | |
187 | |
188 static void | |
4359 | 189 do_insert_image_cb(GObject *obj, GtkWidget *wid) |
190 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
191 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
192 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
193 GaimIm *im; |
4359 | 194 const char *name; |
195 const char *filename; | |
196 char *buf; | |
197 struct stat st; | |
198 int id; | |
199 | |
5106 | 200 conv = g_object_get_data(G_OBJECT(wid), "user_data"); |
4359 | 201 gtkconv = GAIM_GTK_CONVERSATION(conv); |
202 im = GAIM_IM(conv); | |
203 name = gtk_file_selection_get_filename(GTK_FILE_SELECTION(wid)); | |
204 id = g_slist_length(im->images) + 1; | |
205 | |
5966 | 206 if (gaim_gtk_check_if_dir(name, GTK_FILE_SELECTION(wid))) |
4359 | 207 return; |
208 | |
209 gtk_widget_destroy(wid); | |
210 | |
211 if (!name) | |
212 return; | |
213 | |
214 if (stat(name, &st) != 0) { | |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
215 gaim_debug(GAIM_DEBUG_ERROR, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
216 "Could not stat image %s\n", name); |
4359 | 217 return; |
218 } | |
219 | |
220 filename = name; | |
221 while (strchr(filename, '/')) | |
222 filename = strchr(filename, '/') + 1; | |
223 | |
224 buf = g_strdup_printf("<IMG SRC=\"file://%s\" ID=\"%d\" DATASIZE=\"%d\">", | |
225 filename, id, (int)st.st_size); | |
226 im->images = g_slist_append(im->images, g_strdup(name)); | |
227 gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(gtkconv->entry_buffer), | |
228 buf, -1); | |
229 g_free(buf); | |
5046 | 230 |
231 set_toggle(gtkconv->toolbar.image, FALSE); | |
4359 | 232 } |
233 | |
234 static gint | |
235 close_win_cb(GtkWidget *w, GdkEventAny *e, gpointer d) | |
236 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
237 GaimWindow *win = (GaimWindow *)d; |
4359 | 238 |
239 gaim_window_destroy(win); | |
4361
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
240 |
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
241 return TRUE; |
4359 | 242 } |
243 | |
244 static gint | |
245 close_conv_cb(GtkWidget *w, gpointer d) | |
246 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
247 GaimConversation *conv = (GaimConversation *)d; |
4359 | 248 |
249 gaim_conversation_destroy(conv); | |
4361
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
250 |
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
251 return TRUE; |
4359 | 252 } |
253 | |
254 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
255 cancel_insert_image_cb(GtkWidget *unused, GaimGtkConversation *gtkconv) |
5106 | 256 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
257 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.image), |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
258 FALSE); |
5106 | 259 |
260 if (gtkconv->dialogs.image) | |
261 gtk_widget_destroy(gtkconv->dialogs.image); | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
262 |
5106 | 263 gtkconv->dialogs.image = NULL; |
264 } | |
265 | |
266 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
267 insert_image_cb(GtkWidget *save, GaimConversation *conv) |
4359 | 268 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
269 GaimGtkConversation *gtkconv; |
4359 | 270 char buf[BUF_LONG]; |
271 GtkWidget *window; | |
272 | |
273 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
274 | |
5046 | 275 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.image))) { |
276 window = gtk_file_selection_new(_("Gaim - Insert Image")); | |
277 g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S, gaim_home_dir()); | |
278 gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf); | |
279 | |
5106 | 280 g_object_set_data(G_OBJECT(window), "user_data", conv); |
5046 | 281 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(window)->ok_button), |
282 "clicked", G_CALLBACK(do_insert_image_cb), window); | |
5106 | 283 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(window)->cancel_button), |
284 "clicked", G_CALLBACK(cancel_insert_image_cb), gtkconv); | |
5046 | 285 |
286 gtk_widget_show(window); | |
5106 | 287 gtkconv->dialogs.image = window; |
5046 | 288 } else { |
289 gtk_widget_grab_focus(gtkconv->entry); | |
5106 | 290 if(gtkconv->dialogs.image) |
291 gtk_widget_destroy(gtkconv->dialogs.image); | |
292 gtkconv->dialogs.image = NULL; | |
5046 | 293 } |
4359 | 294 } |
295 | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5402
diff
changeset
|
296 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
297 insert_link_cb(GtkWidget *w, GaimConversation *conv) |
4359 | 298 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
299 GaimGtkConversation *gtkconv; |
4359 | 300 |
301 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
302 | |
303 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.link))) | |
304 show_insert_link(gtkconv->toolbar.link, conv); | |
305 else if (gtkconv->dialogs.link) | |
306 cancel_link(gtkconv->toolbar.link, conv); | |
307 else | |
308 gaim_gtk_advance_past(gtkconv, "<A HREF>", "</A>"); | |
309 | |
310 gtk_widget_grab_focus(gtkconv->entry); | |
311 } | |
312 | |
313 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
314 insert_smiley_cb(GtkWidget *smiley, GaimConversation *conv) |
4359 | 315 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
316 GaimGtkConversation *gtkconv; |
4359 | 317 |
318 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
319 | |
320 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(smiley))) | |
321 show_smiley_dialog(conv, smiley); | |
322 else if (gtkconv->dialogs.smiley) | |
323 close_smiley_dialog(smiley, conv); | |
324 | |
325 gtk_widget_grab_focus(gtkconv->entry); | |
326 } | |
327 | |
328 static gboolean | |
329 entry_key_pressed_cb_1(GtkTextBuffer *buffer) | |
330 { | |
331 check_everything(buffer); | |
332 | |
333 return FALSE; | |
334 } | |
335 | |
336 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
337 send_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 338 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
339 GaimGtkConversation *gtkconv; |
4359 | 340 char *buf, *buf2; |
341 GtkTextIter start_iter, end_iter; | |
342 int limit; | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
343 GaimConnection *gc = gaim_conversation_get_gc(conv); |
4359 | 344 |
345 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
346 | |
347 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_iter); | |
348 gtk_text_buffer_get_end_iter(gtkconv->entry_buffer, &end_iter); | |
349 buf2 = gtk_text_buffer_get_text(gtkconv->entry_buffer, | |
350 &start_iter, &end_iter, FALSE); | |
351 | |
4685 | 352 set_toggle(gtkconv->toolbar.bold, FALSE); |
353 set_toggle(gtkconv->toolbar.italic, FALSE); | |
354 set_toggle(gtkconv->toolbar.underline, FALSE); | |
5049 | 355 set_toggle(gtkconv->toolbar.larger_size, FALSE); |
4685 | 356 set_toggle(gtkconv->toolbar.normal_size, FALSE); |
5049 | 357 set_toggle(gtkconv->toolbar.smaller_size,FALSE); |
4685 | 358 set_toggle(gtkconv->toolbar.font, FALSE); |
359 set_toggle(gtkconv->toolbar.fgcolor, FALSE); | |
360 set_toggle(gtkconv->toolbar.bgcolor, FALSE); | |
361 set_toggle(gtkconv->toolbar.link, FALSE); | |
4359 | 362 |
363 gtk_widget_grab_focus(gtkconv->entry); | |
364 | |
365 limit = 32 * 1024; /* This will be done again in gaim_im_send. *shrug* */ | |
366 | |
367 buf = g_malloc(limit); | |
368 strncpy(buf, buf2, limit); | |
369 | |
370 g_free(buf2); | |
371 | |
372 if (strlen(buf) == 0) { | |
373 g_free(buf); | |
374 | |
375 return; | |
376 } | |
377 | |
378 buf2 = g_malloc(limit); | |
379 | |
4505 | 380 if (gc && gc->flags & OPT_CONN_HTML) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
381 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold")) { |
4359 | 382 g_snprintf(buf2, limit, "<B>%s</B>", buf); |
383 strcpy(buf, buf2); | |
384 } | |
385 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
386 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic")) { |
4359 | 387 g_snprintf(buf2, limit, "<I>%s</I>", buf); |
388 strcpy(buf, buf2); | |
389 } | |
390 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
391 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline")) { |
4359 | 392 g_snprintf(buf2, limit, "<U>%s</U>", buf); |
393 strcpy(buf, buf2); | |
394 } | |
395 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
396 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_strikethrough")) { |
4359 | 397 g_snprintf(buf2, limit, "<STRIKE>%s</STRIKE>", buf); |
398 strcpy(buf, buf2); | |
399 } | |
400 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
401 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_font") || |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
402 gtkconv->has_font) { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
403 |
4359 | 404 g_snprintf(buf2, limit, |
405 "<FONT FACE=\"%s\">%s</FONT>", gtkconv->fontface, buf); | |
406 strcpy(buf, buf2); | |
407 } | |
408 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
409 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_size")) { |
4359 | 410 g_snprintf(buf2, limit, |
6141 | 411 "<FONT SIZE=\"%d\">%s</FONT>", |
412 gaim_prefs_get_int("/gaim/gtk/conversations/font_size"), | |
413 buf); | |
4359 | 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 |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2238 if (gtkwin->menu.send_as == NULL) |
4685 | 2239 return FALSE; |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2240 |
4359 | 2241 gtk_widget_show(gtkwin->menu.send_as); |
2242 | |
2243 menu = gtk_menu_item_get_submenu( | |
2244 GTK_MENU_ITEM(gtkwin->menu.send_as)); | |
2245 | |
2246 for (child = gtk_container_get_children(GTK_CONTAINER(menu)); | |
2247 child != NULL; | |
2248 child = child->next) { | |
2249 | |
2250 GtkWidget *item = child->data; | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2251 GaimAccount *item_account = g_object_get_data(G_OBJECT(item), |
4673 | 2252 "gaim_account"); |
2253 | |
2254 if (account == item_account) { | |
4359 | 2255 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE); |
2256 break; | |
2257 } | |
2258 } | |
6030
54c37db13279
[gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents:
6016
diff
changeset
|
2259 |
4685 | 2260 return FALSE; |
4359 | 2261 } |
2262 | |
2263 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2264 generate_send_as_items(GaimWindow *win, GaimConversation *deleted_conv) |
4359 | 2265 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2266 GaimGtkWindow *gtkwin; |
4359 | 2267 GtkWidget *menu; |
2268 GtkWidget *menuitem; | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2269 GList *gcs; |
4359 | 2270 GList *convs; |
2271 GSList *group = NULL; | |
2272 gboolean first_offline = TRUE; | |
2273 gboolean found_online = FALSE; | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2274 GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
4359 | 2275 |
2276 gtkwin = GAIM_GTK_WINDOW(win); | |
2277 | |
2278 if (gtkwin->menu.send_as != NULL) | |
2279 gtk_widget_destroy(gtkwin->menu.send_as); | |
2280 | |
2281 /* See if we have > 1 connection active. */ | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2282 if (g_list_length(gaim_connections_get_all()) < 2) { |
4359 | 2283 /* Now make sure we don't have any Offline entries. */ |
2284 gboolean found_offline = FALSE; | |
2285 | |
2286 for (convs = gaim_get_conversations(); | |
2287 convs != NULL; | |
2288 convs = convs->next) { | |
2289 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2290 GaimConversation *conv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2291 GaimAccount *account; |
4491 | 2292 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2293 conv = (GaimConversation *)convs->data; |
4491 | 2294 account = gaim_conversation_get_account(conv); |
2295 | |
2296 if (account->gc == NULL) { | |
4359 | 2297 found_offline = TRUE; |
2298 break; | |
2299 } | |
2300 } | |
2301 | |
2302 if (!found_offline) { | |
2303 gtkwin->menu.send_as = NULL; | |
2304 return; | |
2305 } | |
2306 } | |
2307 | |
2308 /* Build the Send As menu */ | |
2309 gtkwin->menu.send_as = gtk_menu_item_new_with_mnemonic(_("_Send As")); | |
2310 gtk_widget_show(gtkwin->menu.send_as); | |
2311 | |
2312 menu = gtk_menu_new(); | |
2313 | |
2314 gtk_menu_shell_append(GTK_MENU_SHELL(gtkwin->menu.menubar), | |
2315 gtkwin->menu.send_as); | |
2316 gtk_menu_item_set_submenu(GTK_MENU_ITEM(gtkwin->menu.send_as), menu); | |
2317 | |
2318 gtk_widget_show(menu); | |
2319 | |
2320 /* Fill it with entries. */ | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2321 for (gcs = gaim_connections_get_all(); gcs != NULL; gcs = gcs->next) { |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2322 |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2323 GaimConnection *gc; |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2324 GaimAccount *account; |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2325 GtkWidget *box; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2326 GtkWidget *label; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2327 GtkWidget *image; |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2328 GdkPixbuf *pixbuf, *scale; |
4359 | 2329 |
2330 found_online = TRUE; | |
2331 | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2332 gc = (GaimConnection *)gcs->data; |
4359 | 2333 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2334 /* Create a pixmap for the protocol icon. */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2335 pixbuf = create_prpl_icon(gc->account); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2336 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
|
2337 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2338 /* Now convert it to GtkImage */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2339 if (pixbuf == NULL) |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2340 image = gtk_image_new(); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2341 else |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2342 image = gtk_image_new_from_pixbuf(scale); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2343 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2344 gtk_size_group_add_widget(sg, image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2345 |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2346 g_object_unref(G_OBJECT(scale)); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2347 g_object_unref(G_OBJECT(pixbuf)); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2348 |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2349 account = gaim_connection_get_account(gc); |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2350 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2351 /* Make our menu item */ |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2352 menuitem = gtk_radio_menu_item_new_with_label(group, |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2353 gaim_account_get_username(account)); |
4793 | 2354 group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem)); |
4359 | 2355 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2356 /* Do some evil, see some evil, speak some evil. */ |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2357 box = gtk_hbox_new(FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2358 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2359 label = gtk_bin_get_child(GTK_BIN(menuitem)); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2360 g_object_ref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2361 gtk_container_remove(GTK_CONTAINER(menuitem), label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2362 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2363 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2364 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 4); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2365 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2366 g_object_unref(label); |
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 gtk_container_add(GTK_CONTAINER(menuitem), box); |
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_widget_show(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2371 gtk_widget_show(image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2372 gtk_widget_show(box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2373 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2374 /* Set our data and callbacks. */ |
4359 | 2375 g_object_set_data(G_OBJECT(menuitem), "user_data", win); |
4673 | 2376 g_object_set_data(G_OBJECT(menuitem), "gaim_account", gc->account); |
4359 | 2377 |
4786 | 2378 g_signal_connect(G_OBJECT(menuitem), "activate", |
4673 | 2379 G_CALLBACK(menu_conv_sel_send_cb), NULL); |
4359 | 2380 |
2381 gtk_widget_show(menuitem); | |
2382 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
2383 } | |
2384 | |
2385 /* | |
2386 * Fill it with any accounts that still has an open (yet disabled) window | |
2387 * (signed off accounts with a window open). | |
2388 */ | |
2389 for (convs = gaim_get_conversations(); | |
2390 convs != NULL; | |
2391 convs = convs->next) { | |
2392 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2393 GaimConversation *conv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2394 GaimAccount *account; |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2395 GtkWidget *box; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2396 GtkWidget *label; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2397 GtkWidget *image; |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2398 GdkPixbuf *pixbuf, *scale; |
4359 | 2399 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2400 conv = (GaimConversation *)convs->data; |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
2401 |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
2402 if (conv == deleted_conv) |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
2403 continue; |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
2404 |
4491 | 2405 account = gaim_conversation_get_account(conv); |
2406 | |
4786 | 2407 |
5402 | 2408 if (account && (account->gc == NULL)) { |
4359 | 2409 if (first_offline && found_online) { |
2410 menuitem = gtk_separator_menu_item_new(); | |
2411 gtk_widget_show(menuitem); | |
2412 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
2413 | |
2414 first_offline = FALSE; | |
2415 } | |
2416 | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2417 /* Create a pixmap for the protocol icon. */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2418 pixbuf = create_prpl_icon(account); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2419 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2420 GDK_INTERP_BILINEAR); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2421 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2422 /* Now convert it to GtkImage */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2423 if (pixbuf == NULL) |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2424 image = gtk_image_new(); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2425 else |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2426 image = gtk_image_new_from_pixbuf(scale); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2427 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2428 gtk_size_group_add_widget(sg, image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2429 |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2430 if (scale != NULL) g_object_unref(scale); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2431 if (pixbuf != NULL) g_object_unref(pixbuf); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2432 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2433 /* Make our menu item */ |
4359 | 2434 menuitem = gtk_radio_menu_item_new_with_label(group, |
4491 | 2435 account->username); |
4793 | 2436 group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem)); |
4359 | 2437 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2438 /* Do some evil, see some evil, speak some evil. */ |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2439 box = gtk_hbox_new(FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2440 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2441 label = gtk_bin_get_child(GTK_BIN(menuitem)); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2442 g_object_ref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2443 gtk_container_remove(GTK_CONTAINER(menuitem), label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2444 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2445 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2446 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 4); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2447 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2448 g_object_unref(label); |
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 gtk_container_add(GTK_CONTAINER(menuitem), box); |
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_widget_show(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2453 gtk_widget_show(image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2454 gtk_widget_show(box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2455 |
4359 | 2456 gtk_widget_set_sensitive(menuitem, FALSE); |
4786 | 2457 g_object_set_data(G_OBJECT(menuitem), "user_data", win); |
4674 | 2458 g_object_set_data(G_OBJECT(menuitem), "gaim_account", account); |
4359 | 2459 |
4786 | 2460 g_signal_connect(G_OBJECT(menuitem), "activate", |
5902
6889b89cab90
[gaim-migrate @ 6334]
Christian Hammond <chipx86@chipx86.com>
parents:
5901
diff
changeset
|
2461 G_CALLBACK(menu_conv_sel_send_cb), NULL); |
4786 | 2462 |
4359 | 2463 gtk_widget_show(menuitem); |
2464 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
2465 } | |
2466 } | |
2467 | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2468 g_object_unref(sg); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2469 |
4359 | 2470 gtk_widget_show(gtkwin->menu.send_as); |
2471 update_send_as_selection(win); | |
2472 } | |
2473 | |
2474 static GList * | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2475 generate_invite_user_names(GaimConnection *gc) |
4359 | 2476 { |
4785 | 2477 GaimBlistNode *gnode,*bnode; |
4359 | 2478 struct group *g; |
2479 struct buddy *buddy; | |
2480 static GList *tmp = NULL; | |
2481 | |
2482 if (tmp) | |
2483 g_list_free(tmp); | |
2484 | |
2485 tmp = g_list_append(NULL, ""); | |
2486 | |
2487 if (gc != NULL) { | |
4785 | 2488 for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { |
2489 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) | |
2490 continue; | |
2491 g = (struct group *)gnode; | |
2492 for(bnode = gnode->child; bnode; bnode = bnode->next) { | |
2493 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) | |
2494 continue; | |
2495 buddy = (struct buddy *)bnode; | |
2496 | |
5068 | 2497 if (buddy->account == gc->account && GAIM_BUDDY_IS_ONLINE(buddy)) |
4359 | 2498 tmp = g_list_append(tmp, buddy->name); |
2499 } | |
2500 } | |
2501 } | |
2502 | |
2503 return tmp; | |
2504 } | |
2505 | |
2506 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2507 add_chat_buddy_common(GaimConversation *conv, const char *name, int pos) |
4359 | 2508 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2509 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2510 GaimGtkChatPane *gtkchat; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2511 GaimChat *chat; |
4359 | 2512 GtkTreeIter iter; |
2513 GtkListStore *ls; | |
2514 | |
2515 chat = GAIM_CHAT(conv); | |
2516 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2517 gtkchat = gtkconv->u.chat; | |
2518 | |
2519 ls = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list))); | |
2520 | |
2521 gtk_list_store_append(ls, &iter); | |
2522 gtk_list_store_set(ls, &iter, 0, | |
2523 (gaim_chat_is_user_ignored(chat, name) ? "X" : " "), | |
2524 1, name, -1); | |
2525 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), 1, | |
2526 GTK_SORT_ASCENDING); | |
2527 } | |
2528 | |
2529 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2530 tab_complete(GaimConversation *conv) |
4359 | 2531 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2532 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2533 GaimChat *chat; |
4359 | 2534 GtkTextIter cursor, word_start, start_buffer; |
2535 int start; | |
2536 int most_matched = -1; | |
2537 char *entered, *partial = NULL; | |
2538 char *text; | |
2539 GList *matches = NULL; | |
2540 GList *nicks = NULL; | |
2541 | |
2542 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2543 chat = GAIM_CHAT(conv); | |
2544 | |
2545 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_buffer); | |
2546 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, | |
2547 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
2548 | |
2549 word_start = cursor; | |
2550 | |
2551 /* if there's nothing there just return */ | |
2552 if (!gtk_text_iter_compare(&cursor, &start_buffer)) | |
2553 return; | |
2554 | |
2555 text = gtk_text_buffer_get_text(gtkconv->entry_buffer, &start_buffer, | |
2556 &cursor, FALSE); | |
2557 | |
2558 /* if we're at the end of ": " we need to move back 2 spaces */ | |
2559 start = strlen(text) - 1; | |
2560 | |
2561 if (strlen(text) >= 2 && !strncmp(&text[start-1], ": ", 2)) | |
2562 gtk_text_iter_backward_chars(&word_start, 2); | |
2563 | |
2564 /* find the start of the word that we're tabbing */ | |
2565 while (start >= 0 && text[start] != ' ') { | |
2566 gtk_text_iter_backward_char(&word_start); | |
2567 start--; | |
2568 } | |
2569 | |
2570 g_free(text); | |
2571 | |
2572 entered = gtk_text_buffer_get_text(gtkconv->entry_buffer, &word_start, | |
2573 &cursor, FALSE); | |
2574 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
2575 if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/old_tab_complete")) { |
4359 | 2576 if (strlen(entered) >= 2 && |
2577 !strncmp(": ", entered + strlen(entered) - 2, 2)) { | |
2578 | |
2579 entered[strlen(entered) - 2] = 0; | |
2580 } | |
2581 } | |
2582 | |
2583 if (!strlen(entered)) { | |
2584 g_free(entered); | |
2585 return; | |
2586 } | |
2587 | |
2588 for (nicks = gaim_chat_get_users(chat); | |
2589 nicks != NULL; | |
2590 nicks = nicks->next) { | |
2591 | |
2592 char *nick = nicks->data; | |
2593 /* this checks to see if the current nick could be a completion */ | |
4793 | 2594 if (g_ascii_strncasecmp(nick, entered, strlen(entered))) { |
4621
69f028a6f357
[gaim-migrate @ 4912]
Christian Hammond <chipx86@chipx86.com>
parents:
4608
diff
changeset
|
2595 if (*nick != '+' && *nick != '@' && *nick != '%') |
4359 | 2596 continue; |
2597 | |
4793 | 2598 if (g_ascii_strncasecmp(nick + 1, entered, strlen(entered))) { |
4359 | 2599 if (nick[0] != '@' || nick[1] != '+') |
2600 continue; | |
2601 | |
4793 | 2602 if (g_ascii_strncasecmp(nick + 2, entered, strlen(entered))) |
4359 | 2603 continue; |
2604 else | |
2605 nick += 2; | |
2606 } | |
2607 else | |
2608 nick++; | |
2609 } | |
2610 | |
2611 /* if we're here, it's a possible completion */ | |
2612 | |
2613 /* 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
|
2614 if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/old_tab_complete")) { |
4359 | 2615 gtk_text_buffer_delete(gtkconv->entry_buffer, |
2616 &word_start, &cursor); | |
2617 | |
2618 if (strlen(nick) == strlen(entered)) { | |
2619 nicks = (nicks->next | |
2620 ? nicks->next | |
2621 : gaim_chat_get_users(chat)); | |
2622 | |
2623 nick = nicks->data; | |
2624 | |
2625 if (*nick == '@') nick++; | |
4621
69f028a6f357
[gaim-migrate @ 4912]
Christian Hammond <chipx86@chipx86.com>
parents:
4608
diff
changeset
|
2626 if (*nick == '%') nick++; |
4359 | 2627 if (*nick == '+') nick++; |
2628 } | |
2629 | |
2630 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, | |
2631 &start_buffer); | |
2632 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, | |
2633 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
2634 | |
2635 if (!gtk_text_iter_compare(&cursor, &start_buffer)) { | |
2636 char *tmp = g_strdup_printf("%s: ", nick); | |
2637 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, | |
2638 tmp, -1); | |
2639 g_free(tmp); | |
2640 } | |
2641 else | |
2642 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, | |
2643 nick, -1); | |
2644 | |
2645 g_free(entered); | |
2646 | |
2647 return; | |
2648 } | |
2649 | |
2650 /* we're only here if we're doing new style */ | |
2651 if (most_matched == -1) { | |
2652 /* | |
2653 * this will only get called once, since from now | |
2654 * on most_matched is >= 0 | |
2655 */ | |
2656 most_matched = strlen(nick); | |
2657 partial = g_strdup(nick); | |
2658 } | |
2659 else if (most_matched) { | |
4793 | 2660 while (g_ascii_strncasecmp(nick, partial, most_matched)) |
4359 | 2661 most_matched--; |
2662 | |
2663 partial[most_matched] = 0; | |
2664 } | |
2665 | |
2666 matches = g_list_append(matches, nick); | |
2667 } | |
2668 | |
2669 /* we're only here if we're doing new style */ | |
2670 | |
2671 /* if there weren't any matches, return */ | |
2672 if (!matches) { | |
2673 /* if matches isn't set partials won't be either */ | |
2674 g_free(entered); | |
2675 return; | |
2676 } | |
2677 | |
2678 gtk_text_buffer_delete(gtkconv->entry_buffer, &word_start, &cursor); | |
2679 | |
2680 if (!matches->next) { | |
2681 /* there was only one match. fill it in. */ | |
2682 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_buffer); | |
2683 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, | |
2684 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
2685 | |
2686 if (!gtk_text_iter_compare(&cursor, &start_buffer)) { | |
2687 char *tmp = g_strdup_printf("%s: ", (char *)matches->data); | |
2688 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, tmp, -1); | |
2689 g_free(tmp); | |
2690 } | |
2691 else | |
2692 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, | |
2693 matches->data, -1); | |
2694 | |
2695 matches = g_list_remove(matches, matches->data); | |
2696 } | |
2697 else { | |
2698 /* | |
2699 * there were lots of matches, fill in as much as possible | |
2700 * and display all of them | |
2701 */ | |
2702 char *addthis = g_malloc0(1); | |
2703 | |
2704 while (matches) { | |
2705 char *tmp = addthis; | |
2706 addthis = g_strconcat(tmp, matches->data, " ", NULL); | |
2707 g_free(tmp); | |
2708 matches = g_list_remove(matches, matches->data); | |
2709 } | |
2710 | |
2711 gaim_conversation_write(conv, NULL, addthis, -1, WFLAG_NOLOG, | |
2712 time(NULL)); | |
2713 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, partial, -1); | |
2714 g_free(addthis); | |
2715 } | |
2716 | |
2717 g_free(entered); | |
2718 g_free(partial); | |
2719 } | |
2720 | |
2721 static gboolean | |
2722 meify(char *message, size_t len) | |
2723 { | |
2724 /* | |
2725 * Read /me-ify: If the message (post-HTML) starts with /me, | |
2726 * remove the "/me " part of it (including that space) and return TRUE. | |
2727 */ | |
2728 char *c; | |
2729 gboolean inside_html = 0; | |
2730 | |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2731 /* Umm.. this would be very bad if this happens. */ |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2732 g_return_val_if_fail(message != NULL, FALSE); |
4359 | 2733 |
2734 if (len == -1) | |
2735 len = strlen(message); | |
2736 | |
2737 for (c = message; *c != '\0'; c++, len--) { | |
2738 if (inside_html) { | |
2739 if (*c == '>') | |
2740 inside_html = FALSE; | |
2741 } | |
2742 else { | |
2743 if (*c == '<') | |
2744 inside_html = TRUE; | |
2745 else | |
2746 break; | |
2747 } | |
2748 } | |
2749 | |
4793 | 2750 if (*c != '\0' && !g_ascii_strncasecmp(c, "/me ", 4)) { |
4359 | 2751 memmove(c, c + 4, len - 3); |
2752 | |
2753 return TRUE; | |
2754 } | |
2755 | |
2756 return FALSE; | |
2757 } | |
2758 | |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2759 static void |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2760 save_convo(GtkWidget *save, GaimConversation *c) |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2761 { |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2762 char buf[BUF_LONG]; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2763 GtkWidget *window; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2764 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2765 window = gtk_file_selection_new(_("Gaim - Save Conversation")); |
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 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
|
2768 gaim_home_dir(), normalize(c->name)); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2769 gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2770 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
|
2771 "gaim_conversation", c); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2772 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(window)->ok_button), |
6038 | 2773 "clicked", G_CALLBACK(do_check_save_convo), window); |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2774 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
|
2775 "clicked", G_CALLBACK(gtk_widget_destroy), (gpointer)window); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2776 gtk_widget_show(window); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2777 } |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2778 |
4359 | 2779 static GtkItemFactoryEntry menu_items[] = |
2780 { | |
2781 /* Conversation menu */ | |
4596 | 2782 { N_("/_Conversation"), NULL, NULL, 0, "<Branch>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2783 |
4596 | 2784 { N_("/Conversation/_Save As..."), NULL, menu_save_as_cb, 0, |
4359 | 2785 "<StockItem>", GTK_STOCK_SAVE_AS }, |
5167 | 2786 { 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
|
2787 |
4359 | 2788 { "/Conversation/sep1", NULL, NULL, 0, "<Separator>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2789 |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
2790 { N_("/Conversation/Add Buddy _Pounce..."), NULL, menu_add_pounce_cb, |
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
2791 0, NULL }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2792 { N_("/Conversation/A_lias..."), NULL, menu_alias_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2793 "<StockItem>", GAIM_STOCK_EDIT }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2794 { N_("/Conversation/_Get Info..."), NULL, menu_get_info_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2795 "<StockItem>", GAIM_STOCK_INFO }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2796 { N_("/Conversation/In_vite..."), NULL, menu_invite_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2797 "<StockItem>", GAIM_STOCK_INVITE }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2798 |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
2799 { "/Conversation/sep2", NULL, NULL, 0, "<Separator>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2800 |
4596 | 2801 { N_("/Conversation/Insert _URL..."), NULL, menu_insert_link_cb, 0, |
4359 | 2802 "<StockItem>", GAIM_STOCK_LINK }, |
4596 | 2803 { N_("/Conversation/Insert _Image..."), NULL, menu_insert_image_cb, 0, |
4359 | 2804 "<StockItem>", GAIM_STOCK_IMAGE }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2805 |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
2806 { "/Conversation/sep3", NULL, NULL, 0, "<Separator>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2807 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2808 { N_("/Conversation/_Warn..."), NULL, menu_warn_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2809 "<StockItem>", GAIM_STOCK_WARN }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2810 { N_("/Conversation/_Block..."), NULL, menu_block_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2811 "<StockItem>", GAIM_STOCK_BLOCK }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2812 { N_("/Conversation/_Add..."), NULL, menu_add_remove_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2813 "<StockItem>", GTK_STOCK_ADD }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2814 { N_("/Conversation/_Remove..."), NULL, menu_add_remove_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2815 "<StockItem>", GTK_STOCK_REMOVE }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2816 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2817 { "/Conversation/sep4", NULL, NULL, 0, "<Separator>" }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2818 |
4596 | 2819 { N_("/Conversation/_Close"), NULL, menu_close_conv_cb, 0, |
4359 | 2820 "<StockItem>", GTK_STOCK_CLOSE }, |
2821 | |
2822 /* Options */ | |
4596 | 2823 { N_("/_Options"), NULL, NULL, 0, "<Branch>" }, |
2824 { N_("/Options/Enable _Logging"), NULL, menu_logging_cb, 0, "<CheckItem>" }, | |
2825 { N_("/Options/Enable _Sounds"), NULL, menu_sounds_cb, 0, "<CheckItem>" }, | |
4359 | 2826 }; |
2827 | |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
2828 static const int menu_item_count = |
4359 | 2829 sizeof(menu_items) / sizeof(*menu_items); |
2830 | |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
2831 static char * |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
2832 item_factory_translate_func (const char *path, gpointer func_data) |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
2833 { |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
2834 return _(path); |
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 |
4359 | 2837 static GtkWidget * |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2838 setup_menubar(GaimWindow *win) |
4359 | 2839 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2840 GaimGtkWindow *gtkwin; |
5116 | 2841 GtkAccelGroup *accel_group; |
4359 | 2842 gtkwin = GAIM_GTK_WINDOW(win); |
2843 | |
5116 | 2844 accel_group = gtk_accel_group_new (); |
2845 gtk_window_add_accel_group (GTK_WINDOW (gtkwin->window), accel_group); | |
2846 g_object_unref (accel_group); | |
2847 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2848 gtkwin->menu.item_factory = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2849 gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<main>", accel_group); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2850 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2851 gtk_item_factory_set_translate_func(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2852 item_factory_translate_func, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2853 NULL, NULL); |
4630 | 2854 |
2855 gtk_item_factory_create_items(gtkwin->menu.item_factory, menu_item_count, | |
4359 | 2856 menu_items, win); |
2857 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2858 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2859 gtkwin->menu.menubar = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2860 gtk_item_factory_get_widget(gtkwin->menu.item_factory, "<main>"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2861 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2862 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2863 gtkwin->menu.view_log = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2864 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2865 N_("/Conversation/View Log...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2866 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2867 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2868 gtkwin->menu.add_pounce = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2869 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2870 N_("/Conversation/Add Buddy Pounce...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2871 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2872 gtkwin->menu.alias = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2873 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2874 N_("/Conversation/Alias...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2875 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2876 gtkwin->menu.get_info = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2877 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2878 N_("/Conversation/Get Info...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2879 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2880 gtkwin->menu.invite = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2881 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2882 N_("/Conversation/Invite...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2883 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2884 /* --- */ |
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 gtkwin->menu.insert_link = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2887 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2888 N_("/Conversation/Insert URL...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2889 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2890 gtkwin->menu.insert_image = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2891 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2892 N_("/Conversation/Insert Image...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2893 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2894 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2895 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2896 gtkwin->menu.warn = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2897 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2898 N_("/Conversation/Warn...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2899 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2900 gtkwin->menu.block = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2901 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2902 N_("/Conversation/Block...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2903 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2904 gtkwin->menu.add = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2905 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2906 N_("/Conversation/Add...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2907 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2908 gtkwin->menu.remove = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2909 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2910 N_("/Conversation/Remove...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2911 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2912 /* --- */ |
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 gtkwin->menu.logging = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2915 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2916 N_("/Options/Enable Logging")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2917 gtkwin->menu.sounds = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2918 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2919 N_("/Options/Enable Sounds")); |
4359 | 2920 |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
2921 generate_send_as_items(win, NULL); |
4359 | 2922 |
2923 gtk_widget_show(gtkwin->menu.menubar); | |
4931 | 2924 |
2925 return gtkwin->menu.menubar; | |
4359 | 2926 } |
2927 | |
2928 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2929 setup_im_buttons(GaimConversation *conv, GtkWidget *parent) |
4359 | 2930 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2931 GaimConnection *gc; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2932 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2933 GaimGtkImPane *gtkim; |
4359 | 2934 GaimConversationType type = GAIM_CONV_IM; |
2935 | |
2936 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2937 gtkim = gtkconv->u.im; | |
2938 gc = gaim_conversation_get_gc(conv); | |
2939 | |
2940 /* From right to left... */ | |
2941 | |
2942 /* Send button */ | |
2943 gtkconv->send = gaim_gtk_change_text(_("Send"), gtkconv->send, | |
2944 GAIM_STOCK_SEND, type); | |
2945 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->send, _("Send"), NULL); | |
2946 | |
2947 gtk_box_pack_end(GTK_BOX(parent), gtkconv->send, FALSE, FALSE, 0); | |
2948 | |
2949 /* Separator */ | |
2950 if (gtkim->sep2 != NULL) | |
2951 gtk_widget_destroy(gtkim->sep2); | |
2952 | |
2953 gtkim->sep2 = gtk_vseparator_new(); | |
2954 gtk_box_pack_end(GTK_BOX(parent), gtkim->sep2, FALSE, TRUE, 0); | |
2955 gtk_widget_show(gtkim->sep2); | |
2956 | |
2957 /* Now, um, just kind of all over the place. Huh? */ | |
2958 | |
2959 /* Add button */ | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2960 if (gaim_find_buddy(gaim_conversation_get_account(conv), |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2961 gaim_conversation_get_name(conv)) == NULL) { |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2962 |
4359 | 2963 gtkim->add = gaim_gtk_change_text(_("Add"), gtkim->add, |
2964 GTK_STOCK_ADD, type); | |
2965 gtk_tooltips_set_tip(gtkconv->tooltips, gtkim->add, | |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
2966 _("Add the user to your buddy list"), NULL); |
4359 | 2967 } |
2968 else { | |
2969 gtkim->add = gaim_gtk_change_text(_("Remove"), gtkim->add, | |
2970 GTK_STOCK_REMOVE, type); | |
2971 gtk_tooltips_set_tip(gtkconv->tooltips, gtkim->add, | |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
2972 _("Remove the user from your buddy list"), NULL); |
4359 | 2973 } |
2974 | |
2975 gtk_box_pack_start(GTK_BOX(parent), gtkim->add, | |
2976 FALSE, FALSE, 0); | |
2977 | |
2978 /* Warn button */ | |
2979 gtkim->warn = gaim_gtk_change_text(_("Warn"), gtkim->warn, | |
2980 GAIM_STOCK_WARN, type); | |
2981 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
|
2982 gtk_tooltips_set_tip(gtkconv->tooltips, gtkim->warn, |
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
2983 _("Warn the user"), NULL); |
4359 | 2984 |
2985 /* Info button */ | |
2986 gtkconv->info = gaim_gtk_change_text(_("Info"), gtkconv->info, | |
2987 GAIM_STOCK_INFO, type); | |
2988 gtk_box_pack_start(GTK_BOX(parent), gtkconv->info, FALSE, FALSE, 0); | |
2989 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->info, | |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
2990 _("Get the user's information"), NULL); |
4359 | 2991 |
2992 /* Block button */ | |
2993 gtkim->block = gaim_gtk_change_text(_("Block"), gtkim->block, | |
2994 GAIM_STOCK_BLOCK, type); | |
2995 gtk_box_pack_start(GTK_BOX(parent), gtkim->block, FALSE, FALSE, 0); | |
2996 gtk_tooltips_set_tip(gtkconv->tooltips, gtkim->block, | |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
2997 _("Block the user"), NULL); |
4359 | 2998 |
2999 gtk_button_set_relief(GTK_BUTTON(gtkconv->info), GTK_RELIEF_NONE); | |
3000 gtk_button_set_relief(GTK_BUTTON(gtkim->add), GTK_RELIEF_NONE); | |
3001 gtk_button_set_relief(GTK_BUTTON(gtkim->warn), GTK_RELIEF_NONE); | |
3002 gtk_button_set_relief(GTK_BUTTON(gtkconv->send), GTK_RELIEF_NONE); | |
3003 gtk_button_set_relief(GTK_BUTTON(gtkim->block), GTK_RELIEF_NONE); | |
3004 | |
3005 gtk_size_group_add_widget(gtkconv->sg, gtkconv->info); | |
3006 gtk_size_group_add_widget(gtkconv->sg, gtkim->add); | |
3007 gtk_size_group_add_widget(gtkconv->sg, gtkim->warn); | |
3008 gtk_size_group_add_widget(gtkconv->sg, gtkconv->send); | |
3009 gtk_size_group_add_widget(gtkconv->sg, gtkim->block); | |
3010 | |
3011 gtk_box_reorder_child(GTK_BOX(parent), gtkim->warn, 1); | |
3012 gtk_box_reorder_child(GTK_BOX(parent), gtkim->block, 2); | |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3013 gtk_box_reorder_child(GTK_BOX(parent), gtkim->add, 3); |
4359 | 3014 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->info, 4); |
3015 | |
3016 gaim_gtkconv_update_buttons_by_protocol(conv); | |
3017 | |
3018 g_signal_connect(G_OBJECT(gtkconv->send), "clicked", | |
3019 G_CALLBACK(send_cb), conv); | |
3020 g_signal_connect(G_OBJECT(gtkconv->info), "clicked", | |
3021 G_CALLBACK(info_cb), conv); | |
3022 g_signal_connect(G_OBJECT(gtkim->warn), "clicked", | |
3023 G_CALLBACK(warn_cb), conv); | |
3024 g_signal_connect(G_OBJECT(gtkim->block), "clicked", | |
3025 G_CALLBACK(block_cb), conv); | |
3026 } | |
3027 | |
3028 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3029 setup_chat_buttons(GaimConversation *conv, GtkWidget *parent) |
4359 | 3030 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3031 GaimConnection *gc; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3032 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3033 GaimGtkChatPane *gtkchat; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3034 GaimGtkWindow *gtkwin; |
4359 | 3035 GtkWidget *sep; |
3036 | |
3037 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3038 gtkchat = gtkconv->u.chat; | |
3039 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); | |
3040 gc = gaim_conversation_get_gc(conv); | |
3041 | |
3042 /* Send button */ | |
3043 gtkconv->send = gaim_gtk_change_text(_("Send"), gtkconv->send, | |
3044 GAIM_STOCK_SEND, GAIM_CONV_CHAT); | |
3045 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->send, _("Send"), NULL); | |
3046 | |
3047 gtk_box_pack_end(GTK_BOX(parent), gtkconv->send, FALSE, FALSE, 0); | |
3048 | |
3049 /* Separator */ | |
3050 sep = gtk_vseparator_new(); | |
3051 gtk_box_pack_end(GTK_BOX(parent), sep, FALSE, TRUE, 0); | |
3052 gtk_widget_show(sep); | |
3053 | |
3054 /* Invite */ | |
3055 gtkchat->invite = gaim_gtk_change_text(_("Invite"), gtkchat->invite, | |
3056 GAIM_STOCK_INVITE, GAIM_CONV_CHAT); | |
3057 gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->invite, | |
3058 _("Invite a user"), NULL); | |
3059 gtk_box_pack_end(GTK_BOX(parent), gtkchat->invite, FALSE, FALSE, 0); | |
3060 | |
3061 /* Set the relief on these. */ | |
3062 gtk_button_set_relief(GTK_BUTTON(gtkchat->invite), GTK_RELIEF_NONE); | |
3063 gtk_button_set_relief(GTK_BUTTON(gtkconv->send), GTK_RELIEF_NONE); | |
3064 | |
3065 /* Callbacks */ | |
3066 g_signal_connect(G_OBJECT(gtkconv->send), "clicked", | |
3067 G_CALLBACK(send_cb), conv); | |
3068 g_signal_connect(G_OBJECT(gtkchat->invite), "clicked", | |
3069 G_CALLBACK(invite_cb), conv); | |
3070 } | |
3071 | |
3072 static GtkWidget * | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3073 build_conv_toolbar(GaimConversation *conv) |
4359 | 3074 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3075 GaimGtkConversation *gtkconv; |
4359 | 3076 GtkWidget *vbox; |
3077 GtkWidget *hbox; | |
3078 GtkWidget *button; | |
3079 GtkWidget *sep; | |
3080 GtkSizeGroup *sg; | |
3081 | |
3082 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3083 | |
3084 sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); | |
3085 | |
3086 vbox = gtk_vbox_new(FALSE, 0); | |
3087 sep = gtk_hseparator_new(); | |
3088 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); | |
3089 | |
3090 hbox = gtk_hbox_new(FALSE, 5); | |
3091 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
3092 | |
3093 /* Bold */ | |
3094 button = gaim_pixbuf_toolbar_button_from_stock(GTK_STOCK_BOLD); | |
3095 gtk_size_group_add_widget(sg, button); | |
3096 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3097 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("Bold"), NULL); | |
3098 | |
3099 g_signal_connect(G_OBJECT(button), "clicked", | |
3100 G_CALLBACK(do_bold), gtkconv); | |
3101 | |
3102 gtkconv->toolbar.bold = button; | |
3103 | |
3104 /* Italic */ | |
3105 button = gaim_pixbuf_toolbar_button_from_stock(GTK_STOCK_ITALIC); | |
3106 gtk_size_group_add_widget(sg, button); | |
3107 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3108 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("Italic"), NULL); | |
3109 | |
3110 g_signal_connect(G_OBJECT(button), "clicked", | |
3111 G_CALLBACK(do_italic), gtkconv); | |
3112 | |
3113 gtkconv->toolbar.italic = button; | |
3114 | |
3115 /* Underline */ | |
3116 button = gaim_pixbuf_toolbar_button_from_stock(GTK_STOCK_UNDERLINE); | |
3117 gtk_size_group_add_widget(sg, button); | |
3118 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3119 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("Underline"), NULL); | |
3120 | |
3121 g_signal_connect(G_OBJECT(button), "clicked", | |
3122 G_CALLBACK(do_underline), gtkconv); | |
3123 | |
3124 gtkconv->toolbar.underline = button; | |
3125 | |
3126 /* Sep */ | |
3127 sep = gtk_vseparator_new(); | |
3128 gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 0); | |
3129 | |
3130 /* Increase font size */ | |
3131 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_TEXT_BIGGER); | |
3132 gtk_size_group_add_widget(sg, button); | |
3133 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3134 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
3135 _("Larger font size"), NULL); | |
3136 | |
3137 g_signal_connect(G_OBJECT(button), "clicked", | |
3138 G_CALLBACK(do_big), gtkconv); | |
3139 | |
5049 | 3140 gtkconv->toolbar.larger_size = button; |
3141 | |
4359 | 3142 /* Normal font size */ |
3143 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_TEXT_NORMAL); | |
3144 gtk_size_group_add_widget(sg, button); | |
3145 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3146 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
3147 _("Normal font size"), NULL); | |
3148 | |
3149 g_signal_connect(G_OBJECT(button), "clicked", | |
3150 G_CALLBACK(do_normal), gtkconv); | |
3151 | |
3152 gtkconv->toolbar.normal_size = button; | |
3153 | |
3154 /* Decrease font size */ | |
3155 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_TEXT_SMALLER); | |
3156 gtk_size_group_add_widget(sg, button); | |
3157 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3158 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
3159 _("Smaller font size"), NULL); | |
3160 | |
3161 g_signal_connect(G_OBJECT(button), "clicked", | |
3162 G_CALLBACK(do_small), gtkconv); | |
3163 | |
5049 | 3164 gtkconv->toolbar.smaller_size = button; |
3165 | |
4359 | 3166 /* Sep */ |
3167 sep = gtk_vseparator_new(); | |
3168 gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 0); | |
3169 | |
4685 | 3170 /* Font Face */ |
3171 | |
3172 button = gaim_pixbuf_toolbar_button_from_stock(GTK_STOCK_SELECT_FONT); | |
3173 gtk_size_group_add_widget(sg, button); | |
3174 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3175 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
3176 _("Font Face"), NULL); | |
3177 | |
3178 g_signal_connect(G_OBJECT(button), "clicked", | |
3179 G_CALLBACK(toggle_font), conv); | |
3180 | |
3181 gtkconv->toolbar.font = button; | |
3182 | |
4359 | 3183 /* Foreground Color */ |
3184 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_FGCOLOR); | |
3185 gtk_size_group_add_widget(sg, button); | |
3186 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3187 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
3188 _("Foreground font color"), NULL); | |
3189 | |
3190 g_signal_connect(G_OBJECT(button), "clicked", | |
3191 G_CALLBACK(toggle_fg_color), conv); | |
3192 | |
3193 gtkconv->toolbar.fgcolor = button; | |
3194 | |
3195 /* Background Color */ | |
3196 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_BGCOLOR); | |
3197 gtk_size_group_add_widget(sg, button); | |
3198 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3199 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
3200 _("Background color"), NULL); | |
3201 | |
3202 g_signal_connect(G_OBJECT(button), "clicked", | |
3203 G_CALLBACK(toggle_bg_color), conv); | |
3204 | |
3205 gtkconv->toolbar.bgcolor = button; | |
3206 | |
3207 /* Sep */ | |
3208 sep = gtk_vseparator_new(); | |
3209 gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 0); | |
3210 | |
3211 /* Insert IM Image */ | |
3212 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_IMAGE); | |
3213 gtk_size_group_add_widget(sg, button); | |
3214 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3215 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("Insert image"), NULL); | |
3216 | |
3217 g_signal_connect(G_OBJECT(button), "clicked", | |
3218 G_CALLBACK(insert_image_cb), conv); | |
3219 | |
3220 gtkconv->toolbar.image = button; | |
3221 | |
3222 /* Insert Link */ | |
3223 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_LINK); | |
3224 gtk_size_group_add_widget(sg, button); | |
3225 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3226 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("Insert link"), NULL); | |
3227 | |
3228 g_signal_connect(G_OBJECT(button), "clicked", | |
3229 G_CALLBACK(insert_link_cb), conv); | |
3230 | |
3231 gtkconv->toolbar.link = button; | |
3232 | |
3233 /* Insert Smiley */ | |
3234 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_SMILEY); | |
3235 gtk_size_group_add_widget(sg, button); | |
3236 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3237 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("Insert smiley"), NULL); | |
3238 | |
3239 g_signal_connect(G_OBJECT(button), "clicked", | |
3240 G_CALLBACK(insert_smiley_cb), conv); | |
3241 | |
3242 gtkconv->toolbar.smiley = button; | |
3243 | |
3244 | |
3245 sep = gtk_hseparator_new(); | |
3246 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); | |
3247 | |
3248 gtk_widget_show_all(vbox); | |
3249 | |
3250 return vbox; | |
3251 } | |
3252 | |
3253 static GtkWidget * | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3254 setup_chat_pane(GaimConversation *conv) |
4359 | 3255 { |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3256 GaimPluginProtocolInfo *prpl_info = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3257 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3258 GaimGtkChatPane *gtkchat; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3259 GaimConnection *gc; |
4359 | 3260 GtkWidget *vpaned, *hpaned; |
3261 GtkWidget *vbox, *hbox; | |
3262 GtkWidget *lbox, *bbox; | |
3263 GtkWidget *label; | |
3264 GtkWidget *sw2; | |
3265 GtkWidget *list; | |
3266 GtkWidget *button; | |
3267 GtkWidget *frame; | |
3268 GtkListStore *ls; | |
3269 GtkCellRenderer *rend; | |
3270 GtkTreeViewColumn *col; | |
3271 | |
3272 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3273 gtkchat = gtkconv->u.chat; | |
3274 gc = gaim_conversation_get_gc(conv); | |
3275 | |
3276 /* Setup the outer pane. */ | |
3277 vpaned = gtk_vpaned_new(); | |
3278 gtk_widget_show(vpaned); | |
3279 | |
3280 /* Setup the top part of the pane. */ | |
3281 vbox = gtk_vbox_new(FALSE, 5); | |
3282 gtk_paned_pack1(GTK_PANED(vpaned), vbox, TRUE, FALSE); | |
3283 gtk_widget_show(vbox); | |
3284 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3285 if (gc != NULL) |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3286 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3287 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3288 if (prpl_info->options & OPT_PROTO_CHAT_TOPIC) |
4359 | 3289 { |
3290 hbox = gtk_hbox_new(FALSE, 0); | |
3291 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
3292 gtk_widget_show(hbox); | |
3293 | |
3294 label = gtk_label_new(_("Topic:")); | |
3295 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
3296 gtk_widget_show(label); | |
3297 | |
3298 gtkchat->topic_text = gtk_entry_new(); | |
4635 | 3299 gtk_editable_set_editable(GTK_EDITABLE(gtkchat->topic_text), FALSE); |
4359 | 3300 gtk_box_pack_start(GTK_BOX(hbox), gtkchat->topic_text, TRUE, TRUE, 5); |
3301 gtk_widget_show(gtkchat->topic_text); | |
3302 } | |
3303 | |
3304 /* Setup the horizontal pane. */ | |
3305 hpaned = gtk_hpaned_new(); | |
3306 gtk_box_pack_start(GTK_BOX(vbox), hpaned, TRUE, TRUE, 5); | |
3307 gtk_widget_show(hpaned); | |
3308 | |
3309 /* Setup the scrolled window to put gtkimhtml in. */ | |
3310 gtkconv->sw = gtk_scrolled_window_new(NULL, NULL); | |
3311 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
3312 GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); | |
3313 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
3314 GTK_SHADOW_IN); | |
3315 gtk_paned_pack1(GTK_PANED(hpaned), gtkconv->sw, TRUE, TRUE); | |
3316 | |
3317 gtk_widget_set_size_request(gtkconv->sw, | |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3318 gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_width"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3319 gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_height")); |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3320 |
4359 | 3321 gtk_widget_show(gtkconv->sw); |
3322 | |
3323 /* Setup gtkihmtml. */ | |
3324 gtkconv->imhtml = gtk_imhtml_new(NULL, NULL); | |
3325 gtk_container_add(GTK_CONTAINER(gtkconv->sw), gtkconv->imhtml); | |
3326 | |
3327 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3328 gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); |
4359 | 3329 |
3330 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", | |
3331 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
6057 | 3332 g_signal_connect(G_OBJECT(gtkconv->imhtml), "button_release_event", |
3333 G_CALLBACK(refocus_entry_cb), gtkconv); | |
4359 | 3334 |
3335 gaim_setup_imhtml(gtkconv->imhtml); | |
3336 | |
3337 gtk_widget_show(gtkconv->imhtml); | |
3338 | |
3339 /* Build the right pane. */ | |
3340 lbox = gtk_vbox_new(FALSE, 5); | |
4409
0521eec12c33
[gaim-migrate @ 4682]
Christian Hammond <chipx86@chipx86.com>
parents:
4398
diff
changeset
|
3341 gtk_paned_pack2(GTK_PANED(hpaned), lbox, FALSE, TRUE); |
4359 | 3342 gtk_widget_show(lbox); |
3343 | |
3344 /* Setup the label telling how many people are in the room. */ | |
3345 gtkchat->count = gtk_label_new(_("0 people in room")); | |
3346 gtk_box_pack_start(GTK_BOX(lbox), gtkchat->count, FALSE, FALSE, 0); | |
3347 gtk_widget_show(gtkchat->count); | |
3348 | |
3349 /* Setup the list of users. */ | |
3350 sw2 = gtk_scrolled_window_new(NULL, NULL); | |
3351 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw2), | |
3352 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); | |
3353 gtk_box_pack_start(GTK_BOX(lbox), sw2, TRUE, TRUE, 0); | |
3354 gtk_widget_show(sw2); | |
3355 | |
3356 ls = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING); | |
3357 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), 1, | |
3358 GTK_SORT_ASCENDING); | |
3359 | |
3360 list = gtk_tree_view_new_with_model(GTK_TREE_MODEL(ls)); | |
3361 | |
3362 rend = gtk_cell_renderer_text_new(); | |
3363 col = gtk_tree_view_column_new_with_attributes(NULL, rend, | |
3364 "text", 0, NULL); | |
3365 gtk_tree_view_column_set_clickable(GTK_TREE_VIEW_COLUMN(col), TRUE); | |
3366 | |
3367 g_signal_connect(G_OBJECT(list), "button_press_event", | |
3368 G_CALLBACK(right_click_chat_cb), conv); | |
3369 | |
3370 gtk_tree_view_append_column(GTK_TREE_VIEW(list), col); | |
3371 | |
3372 col = gtk_tree_view_column_new_with_attributes(NULL, rend, | |
3373 "text", 1, NULL); | |
3374 gtk_tree_view_column_set_clickable(GTK_TREE_VIEW_COLUMN(col), TRUE); | |
3375 | |
3376 #if 0 | |
3377 g_signal_connect(G_OBJECT(list), "button_press_event", | |
3378 G_CALLBACK(right_click_chat), conv); | |
3379 #endif | |
3380 | |
3381 gtk_tree_view_append_column(GTK_TREE_VIEW(list), col); | |
3382 | |
3383 gtk_widget_set_size_request(list, 150, -1); | |
3384 | |
3385 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(list), FALSE); | |
3386 gtk_widget_show(list); | |
3387 | |
3388 gtkchat->list = list; | |
3389 | |
3390 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw2), list); | |
3391 | |
3392 /* Setup the user list toolbar. */ | |
3393 bbox = gtk_hbox_new(TRUE, 5); | |
3394 gtk_box_pack_start(GTK_BOX(lbox), bbox, FALSE, FALSE, 0); | |
3395 gtk_widget_show(bbox); | |
3396 | |
3397 /* IM */ | |
3398 button = gaim_pixbuf_button_from_stock(NULL, GTK_STOCK_REDO, | |
3399 GAIM_BUTTON_VERTICAL); | |
3400 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
3401 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
|
3402 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("IM the user"), NULL); |
4359 | 3403 g_signal_connect(G_OBJECT(button), "clicked", |
3404 G_CALLBACK(im_cb), conv); | |
3405 | |
3406 gtk_widget_show(button); | |
3407 | |
3408 /* Ignore */ | |
3409 button = gaim_pixbuf_button_from_stock(NULL, GAIM_STOCK_IGNORE, | |
3410 GAIM_BUTTON_VERTICAL); | |
3411 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
3412 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
|
3413 gtk_tooltips_set_tip(gtkconv->tooltips, button, |
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3414 _("Ignore the user"), NULL); |
4359 | 3415 g_signal_connect(G_OBJECT(button), "clicked", |
3416 G_CALLBACK(ignore_cb), conv); | |
3417 gtk_widget_show(button); | |
3418 | |
3419 /* Info */ | |
3420 button = gaim_pixbuf_button_from_stock(NULL, GAIM_STOCK_INFO, | |
3421 GAIM_BUTTON_VERTICAL); | |
3422 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
3423 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
3424 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3425 _("Get the user's information"), NULL); |
4359 | 3426 g_signal_connect(G_OBJECT(button), "clicked", |
3427 G_CALLBACK(info_cb), conv); | |
3428 | |
3429 gtk_widget_show(button); | |
3430 | |
3431 gtkconv->info = button; | |
3432 | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3433 /* Build the toolbar. */ |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3434 vbox = gtk_vbox_new(FALSE, 5); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3435 gtk_paned_pack2(GTK_PANED(vpaned), vbox, FALSE, FALSE); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3436 gtk_widget_show(vbox); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3437 |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3438 gtkconv->toolbar.toolbar = build_conv_toolbar(conv); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3439 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->toolbar.toolbar, |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3440 FALSE, FALSE, 0); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3441 |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3442 /* Setup the entry widget. */ |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3443 frame = gtk_frame_new(NULL); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3444 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3445 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3446 gtk_widget_show(frame); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3447 |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3448 gtkconv->entry_buffer = gtk_text_buffer_new(NULL); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3449 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
|
3450 gtkconv->entry = gtk_text_view_new_with_buffer(gtkconv->entry_buffer); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3451 |
5105 | 3452 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
|
3453 gtk_widget_set_size_request(gtkconv->entry, -1, |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3454 MAX(gaim_prefs_get_int("/gaim/gtk/conversations/chat/entry_height"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3455 25)); |
4359 | 3456 |
3457 /* Connect the signal handlers. */ | |
3458 g_signal_connect_swapped(G_OBJECT(gtkconv->entry), "key_press_event", | |
3459 G_CALLBACK(entry_key_pressed_cb_1), | |
3460 gtkconv->entry_buffer); | |
3461 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", | |
3462 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
3463 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", | |
3464 G_CALLBACK(entry_key_pressed_cb_2), conv); | |
3465 | |
3466 #ifdef USE_GTKSPELL | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3467 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) |
4359 | 3468 gtkspell_new_attach(GTK_TEXT_VIEW(gtkconv->entry), NULL, NULL); |
3469 #endif | |
3470 | |
3471 gtk_container_add(GTK_CONTAINER(frame), GTK_WIDGET(gtkconv->entry)); | |
3472 gtk_widget_show(gtkconv->entry); | |
3473 | |
3474 /* Setup the bottom button box. */ | |
3475 gtkconv->bbox = gtk_hbox_new(FALSE, 5); | |
3476 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->bbox, FALSE, FALSE, 0); | |
3477 gtk_widget_show(gtkconv->bbox); | |
3478 | |
3479 setup_chat_buttons(conv, gtkconv->bbox); | |
3480 | |
3481 return vpaned; | |
3482 } | |
3483 | |
3484 static GtkWidget * | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3485 setup_im_pane(GaimConversation *conv) |
4359 | 3486 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3487 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3488 GaimGtkImPane *gtkim; |
4359 | 3489 GtkWidget *paned; |
3490 GtkWidget *vbox; | |
3491 GtkWidget *vbox2; | |
3492 GtkWidget *frame; | |
3493 | |
3494 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3495 gtkim = gtkconv->u.im; | |
3496 | |
3497 /* Setup the outer pane. */ | |
3498 paned = gtk_vpaned_new(); | |
3499 gtk_widget_show(paned); | |
3500 | |
3501 /* Setup the top part of the pane. */ | |
3502 vbox = gtk_vbox_new(FALSE, 5); | |
4409
0521eec12c33
[gaim-migrate @ 4682]
Christian Hammond <chipx86@chipx86.com>
parents:
4398
diff
changeset
|
3503 gtk_paned_pack1(GTK_PANED(paned), vbox, TRUE, TRUE); |
4359 | 3504 gtk_widget_show(vbox); |
3505 | |
3506 /* Setup the gtkimhtml widget. */ | |
3507 gtkconv->sw = gtk_scrolled_window_new(NULL, NULL); | |
3508 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
3509 GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); | |
3510 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
3511 GTK_SHADOW_IN); | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3512 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->sw, TRUE, TRUE, 0); |
4851 | 3513 |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3514 gtk_widget_set_size_request(gtkconv->sw, |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3515 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_width"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3516 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_height")); |
4359 | 3517 gtk_widget_show(gtkconv->sw); |
3518 | |
3519 gtkconv->imhtml = gtk_imhtml_new(NULL, NULL); | |
3520 gtk_container_add(GTK_CONTAINER(gtkconv->sw), gtkconv->imhtml); | |
3521 | |
3522 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", | |
3523 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
6057 | 3524 g_signal_connect(G_OBJECT(gtkconv->imhtml), "button_release_event", |
3525 G_CALLBACK(refocus_entry_cb), gtkconv); | |
4359 | 3526 |
3527 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3528 gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); |
4359 | 3529 |
3530 gaim_setup_imhtml(gtkconv->imhtml); | |
3531 | |
3532 gtk_widget_show(gtkconv->imhtml); | |
3533 | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3534 vbox2 = gtk_vbox_new(FALSE, 5); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3535 gtk_paned_pack2(GTK_PANED(paned), vbox2, FALSE, FALSE); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3536 gtk_widget_show(vbox2); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3537 |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3538 /* Build the toolbar. */ |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3539 gtkconv->toolbar.toolbar = build_conv_toolbar(conv); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3540 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->toolbar.toolbar, |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3541 FALSE, FALSE, 0); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3542 |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3543 /* Setup the entry widget. */ |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3544 frame = gtk_frame_new(NULL); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3545 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3546 gtk_box_pack_start(GTK_BOX(vbox2), frame, TRUE, TRUE, 0); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3547 gtk_widget_show(frame); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3548 |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3549 gtkconv->entry_buffer = gtk_text_buffer_new(NULL); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3550 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
|
3551 gtkconv->entry = gtk_text_view_new_with_buffer(gtkconv->entry_buffer); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3552 |
5105 | 3553 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
|
3554 gtk_widget_set_size_request(gtkconv->entry, -1, |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3555 MAX(gaim_prefs_get_int("/gaim/gtk/conversations/im/entry_height"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3556 25)); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3557 |
4359 | 3558 g_signal_connect_swapped(G_OBJECT(gtkconv->entry), "key_press_event", |
3559 G_CALLBACK(entry_key_pressed_cb_1), | |
3560 gtkconv->entry_buffer); | |
3561 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", | |
3562 G_CALLBACK(entry_key_pressed_cb_2), conv); | |
3563 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", | |
3564 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
3565 | |
3566 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "insert_text", | |
3567 G_CALLBACK(insert_text_cb), conv); | |
3568 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "delete_range", | |
3569 G_CALLBACK(delete_text_cb), conv); | |
3570 | |
3571 #ifdef USE_GTKSPELL | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3572 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) |
4359 | 3573 gtkspell_new_attach(GTK_TEXT_VIEW(gtkconv->entry), NULL, NULL); |
3574 #endif | |
3575 | |
3576 gtk_container_add(GTK_CONTAINER(frame), GTK_WIDGET(gtkconv->entry)); | |
3577 gtk_widget_show(gtkconv->entry); | |
3578 | |
3579 gtkconv->bbox = gtk_hbox_new(FALSE, 5); | |
3580 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->bbox, FALSE, FALSE, 0); | |
3581 gtk_widget_show(gtkconv->bbox); | |
3582 | |
3583 setup_im_buttons(conv, gtkconv->bbox); | |
3584 | |
3585 return paned; | |
3586 } | |
3587 | |
3588 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3589 move_next_tab(GaimConversation *conv) |
4359 | 3590 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3591 GaimConversation *next_conv = NULL; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3592 GaimWindow *win; |
4359 | 3593 GList *l; |
3594 int index, i; | |
3595 | |
3596 win = gaim_conversation_get_window(conv); | |
3597 index = gaim_conversation_get_index(conv); | |
3598 | |
3599 /* First check the tabs after this position. */ | |
3600 for (l = g_list_nth(gaim_window_get_conversations(win), index); | |
3601 l != NULL; | |
3602 l = l->next) { | |
3603 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3604 next_conv = (GaimConversation *)l->data; |
4359 | 3605 |
3606 if (gaim_conversation_get_unseen(next_conv) > 0) | |
3607 break; | |
3608 | |
3609 next_conv = NULL; | |
3610 } | |
3611 | |
3612 if (next_conv == NULL) { | |
3613 | |
3614 /* Now check before this position. */ | |
3615 for (l = gaim_window_get_conversations(win), i = 0; | |
3616 l != NULL && i < index; | |
3617 l = l->next) { | |
3618 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3619 next_conv = (GaimConversation *)l->data; |
4359 | 3620 |
3621 if (gaim_conversation_get_unseen(next_conv) > 0) | |
3622 break; | |
3623 | |
3624 next_conv = NULL; | |
3625 } | |
3626 | |
3627 if (next_conv == NULL) { | |
3628 /* Okay, just grab the next conversation tab. */ | |
3629 if (index == gaim_window_get_conversation_count(win) - 1) | |
3630 next_conv = gaim_window_get_conversation_at(win, 0); | |
3631 else | |
3632 next_conv = gaim_window_get_conversation_at(win, index + 1); | |
3633 } | |
3634 } | |
3635 | |
3636 if (next_conv != NULL && next_conv != conv) { | |
3637 gaim_window_switch_conversation(win, | |
3638 gaim_conversation_get_index(next_conv)); | |
3639 } | |
3640 } | |
3641 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3642 static void |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3643 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
|
3644 GtkSelectionData *sd, guint info, guint t, |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3645 GaimConversation *conv) |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3646 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3647 GaimWindow *win = conv->window; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3648 GaimConversation *c; |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3649 |
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3650 if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE)) { |
4781 | 3651 GaimBlistNode *n = NULL; |
3652 memcpy(&n, sd->data, sizeof(n)); | |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3653 |
4781 | 3654 if (!GAIM_BLIST_NODE_IS_BUDDY(n)) |
3655 return; | |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3656 |
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3657 c = gaim_conversation_new(GAIM_CONV_IM, |
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3658 ((struct buddy *)n)->account, |
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3659 ((struct buddy *)n)->name); |
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3660 |
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3661 gaim_window_add_conversation(win, c); |
4702 | 3662 } |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3663 } |
4359 | 3664 |
3665 /************************************************************************** | |
3666 * GTK+ window ops | |
3667 **************************************************************************/ | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3668 static GaimConversationUiOps * |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
3669 gaim_gtk_get_conversation_ui_ops(void) |
4359 | 3670 { |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
3671 return gaim_get_gtk_conversation_ui_ops(); |
4359 | 3672 } |
3673 | |
3674 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3675 gaim_gtk_new_window(GaimWindow *win) |
4359 | 3676 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3677 GaimGtkWindow *gtkwin; |
4359 | 3678 GtkPositionType pos; |
3679 GtkWidget *testidea; | |
3680 GtkWidget *menubar; | |
3681 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3682 gtkwin = g_malloc0(sizeof(GaimGtkWindow)); |
4359 | 3683 |
3684 win->ui_data = gtkwin; | |
3685 | |
3686 /* Create the window. */ | |
3687 gtkwin->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
3688 gtk_window_set_role(GTK_WINDOW(gtkwin->window), "conversation"); | |
4635 | 3689 gtk_window_set_resizable(GTK_WINDOW(gtkwin->window), TRUE); |
4510
4c394222c732
[gaim-migrate @ 4786]
Christian Hammond <chipx86@chipx86.com>
parents:
4505
diff
changeset
|
3690 gtk_container_set_border_width(GTK_CONTAINER(gtkwin->window), 0); |
5173 | 3691 GTK_WINDOW(gtkwin->window)->allow_shrink = TRUE; |
4359 | 3692 gtk_widget_realize(gtkwin->window); |
3693 | |
3694 g_signal_connect(G_OBJECT(gtkwin->window), "delete_event", | |
3695 G_CALLBACK(close_win_cb), win); | |
3696 | |
3697 /* Create the notebook. */ | |
3698 gtkwin->notebook = gtk_notebook_new(); | |
3699 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3700 pos = gaim_prefs_get_int("/gaim/gtk/conversations/tab_side"); |
4359 | 3701 |
3702 #if 0 | |
3703 gtk_notebook_set_tab_hborder(GTK_NOTEBOOK(gtkwin->notebook), 0); | |
3704 gtk_notebook_set_tab_vborder(GTK_NOTEBOOK(gtkwin->notebook), 0); | |
3705 #endif | |
3706 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos); | |
3707 gtk_notebook_set_scrollable(GTK_NOTEBOOK(gtkwin->notebook), TRUE); | |
3708 gtk_notebook_popup_enable(GTK_NOTEBOOK(gtkwin->notebook)); | |
4818 | 3709 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), FALSE); |
3710 | |
4359 | 3711 gtk_widget_show(gtkwin->notebook); |
3712 | |
3713 g_signal_connect_after(G_OBJECT(gtkwin->notebook), "switch_page", | |
3714 G_CALLBACK(switch_conv_cb), win); | |
3715 | |
3716 /* Setup the tab drag and drop signals. */ | |
4486 | 3717 gtk_widget_add_events(gtkwin->notebook, |
3718 GDK_BUTTON1_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK); | |
3719 g_signal_connect(G_OBJECT(gtkwin->notebook), "button_press_event", | |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
3720 G_CALLBACK(notebook_press_cb), win); |
4486 | 3721 g_signal_connect(G_OBJECT(gtkwin->notebook), "button_release_event", |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
3722 G_CALLBACK(notebook_release_cb), win); |
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
3723 |
4359 | 3724 testidea = gtk_vbox_new(FALSE, 0); |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
3725 |
4359 | 3726 /* Setup the menubar. */ |
3727 menubar = setup_menubar(win); | |
3728 gtk_box_pack_start(GTK_BOX(testidea), menubar, FALSE, TRUE, 0); | |
3729 | |
3730 gtk_box_pack_start(GTK_BOX(testidea), gtkwin->notebook, TRUE, TRUE, 0); | |
3731 | |
3732 gtk_container_add(GTK_CONTAINER(gtkwin->window), testidea); | |
3733 | |
3734 gtk_widget_show(testidea); | |
3735 } | |
3736 | |
3737 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3738 gaim_gtk_destroy_window(GaimWindow *win) |
4359 | 3739 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3740 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 3741 |
3742 gtk_widget_destroy(gtkwin->window); | |
3743 | |
4630 | 3744 g_object_unref(G_OBJECT(gtkwin->menu.item_factory)); |
3745 | |
4359 | 3746 g_free(gtkwin); |
3747 win->ui_data = NULL; | |
3748 } | |
3749 | |
3750 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3751 gaim_gtk_show(GaimWindow *win) |
4359 | 3752 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3753 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 3754 |
3755 gtk_widget_show(gtkwin->window); | |
3756 } | |
3757 | |
3758 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3759 gaim_gtk_hide(GaimWindow *win) |
4359 | 3760 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3761 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 3762 |
3763 gtk_widget_hide(gtkwin->window); | |
3764 } | |
3765 | |
3766 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3767 gaim_gtk_raise(GaimWindow *win) |
4359 | 3768 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3769 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 3770 |
5484 | 3771 gtk_widget_show(gtkwin->window); |
5103 | 3772 gtk_window_deiconify(GTK_WINDOW(gtkwin->window)); |
4526 | 3773 gdk_window_raise(gtkwin->window->window); |
4359 | 3774 } |
3775 | |
3776 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3777 gaim_gtk_flash(GaimWindow *win) |
4359 | 3778 { |
3779 #ifdef _WIN32 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3780 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 3781 |
3782 wgaim_im_blink(gtkwin->window); | |
3783 #endif | |
3784 } | |
3785 | |
3786 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3787 gaim_gtk_switch_conversation(GaimWindow *win, unsigned int index) |
4359 | 3788 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3789 GaimGtkWindow *gtkwin; |
4359 | 3790 |
3791 gtkwin = GAIM_GTK_WINDOW(win); | |
3792 | |
3793 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), index); | |
3794 } | |
3795 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3796 static const GtkTargetEntry te[] = |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3797 { |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3798 {"text/plain", 0, 0}, |
4702 | 3799 {"text/uri-list", 0, 1}, |
4781 | 3800 {"GAIM_BLIST_NODE", 0, 2}, |
4702 | 3801 {"STRING", 0, 3} |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3802 }; |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3803 |
4359 | 3804 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3805 gaim_gtk_add_conversation(GaimWindow *win, GaimConversation *conv) |
4359 | 3806 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3807 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3808 GaimGtkConversation *gtkconv, *focus_gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3809 GaimConversation *focus_conv; |
4359 | 3810 GtkWidget *pane = NULL; |
3811 GtkWidget *tab_cont; | |
3812 GtkWidget *tabby; | |
3813 gboolean new_ui; | |
4383
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3814 GaimConversationType conv_type; |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3815 const char *name; |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3816 |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3817 name = gaim_conversation_get_name(conv); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3818 conv_type = gaim_conversation_get_type(conv); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3819 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 3820 |
3821 if (conv->ui_data != NULL) { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3822 gtkconv = (GaimGtkConversation *)conv->ui_data; |
4359 | 3823 |
3824 tab_cont = gtkconv->tab_cont; | |
3825 | |
3826 new_ui = FALSE; | |
3827 } | |
3828 else { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3829 gtkconv = g_malloc0(sizeof(GaimGtkConversation)); |
4359 | 3830 conv->ui_data = gtkconv; |
3831 | |
3832 /* Setup some initial variables. */ | |
3833 gtkconv->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
3834 gtkconv->tooltips = gtk_tooltips_new(); | |
3835 | |
4421 | 3836 /* Setup the foreground and background colors */ |
3837 gaim_gtkconv_update_font_colors(conv); | |
3838 | |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
3839 /* Setup the font face */ |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
3840 gaim_gtkconv_update_font_face(conv); |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
3841 |
4383
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3842 if (conv_type == GAIM_CONV_CHAT) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3843 gtkconv->u.chat = g_malloc0(sizeof(GaimGtkChatPane)); |
4359 | 3844 |
3845 pane = setup_chat_pane(conv); | |
3846 } | |
4383
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3847 else if (conv_type == GAIM_CONV_IM) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3848 gtkconv->u.im = g_malloc0(sizeof(GaimGtkImPane)); |
4359 | 3849 gtkconv->u.im->a_virgin = TRUE; |
3850 | |
3851 pane = setup_im_pane(conv); | |
3852 } | |
3853 | |
3854 if (pane == NULL) { | |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
3855 if (conv_type == GAIM_CONV_CHAT) g_free(gtkconv->u.chat); |
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
3856 else if (conv_type == GAIM_CONV_IM) g_free(gtkconv->u.im); |
4359 | 3857 |
3858 g_free(gtkconv); | |
3859 conv->ui_data = NULL; | |
3860 | |
3861 return; | |
3862 } | |
3863 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3864 /* Setup drag-and-drop */ |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3865 gtk_drag_dest_set(pane, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3866 GTK_DEST_DEFAULT_MOTION | |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3867 GTK_DEST_DEFAULT_DROP, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3868 te, sizeof(te) / sizeof(GtkTargetEntry), |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3869 GDK_ACTION_COPY); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3870 gtk_drag_dest_set(gtkconv->imhtml, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3871 GTK_DEST_DEFAULT_MOTION | |
4702 | 3872 GTK_DEST_DEFAULT_DROP, |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3873 te, sizeof(te) / sizeof(GtkTargetEntry), |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3874 GDK_ACTION_DEFAULT | GDK_ACTION_COPY | GDK_ACTION_MOVE); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3875 gtk_drag_dest_set(gtkconv->entry, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3876 GTK_DEST_DEFAULT_MOTION | |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3877 GTK_DEST_DEFAULT_DROP, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3878 te, sizeof(te) / sizeof(GtkTargetEntry), |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3879 GDK_ACTION_COPY); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3880 |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3881 g_signal_connect(G_OBJECT(pane), "drag_data_received", |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3882 G_CALLBACK(conv_dnd_recv), conv); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3883 g_signal_connect(G_OBJECT(gtkconv->imhtml), "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 #if 0 |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3886 g_signal_connect(G_OBJECT(gtkconv->entry), "drag_data_received", |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3887 G_CALLBACK(conv_dnd_recv), conv); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3888 #endif |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3889 |
4383
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3890 /* |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3891 * Write the New Conversation log string. |
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 * This should probably be elsewhere, but then, logging should |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3894 * 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
|
3895 */ |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3896 if (gaim_conversation_is_logging(conv) && |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3897 conv_type != GAIM_CONV_MISC) { |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3898 |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3899 FILE *fd; |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3900 char filename[256]; |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3901 |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3902 g_snprintf(filename, sizeof(filename), "%s%s", name, |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3903 (conv_type == GAIM_CONV_CHAT ? ".chat" : "")); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3904 |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3905 fd = open_log_file(filename, (conv_type == GAIM_CONV_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 if (fd) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3908 if (!gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) |
4383
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3909 fprintf(fd, |
6089 | 3910 _("<HR><BR><H3 Align=Center> " |
3911 "---- New Conversation @ %s ----</H3><BR>\n"), | |
4383
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3912 full_date()); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3913 else |
6089 | 3914 fprintf(fd, _("---- New Conversation @ %s ----\n"), |
4383
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3915 full_date()); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3916 |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3917 fclose(fd); |
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 } |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
3920 |
4359 | 3921 /* Setup the container for the tab. */ |
3922 gtkconv->tab_cont = tab_cont = gtk_vbox_new(FALSE, 5); | |
3923 gtk_container_set_border_width(GTK_CONTAINER(tab_cont), 5); | |
3924 gtk_container_add(GTK_CONTAINER(tab_cont), pane); | |
3925 gtk_widget_show(pane); | |
3926 | |
3927 new_ui = TRUE; | |
4636 | 3928 |
4359 | 3929 gtkconv->make_sound = TRUE; |
5902
6889b89cab90
[gaim-migrate @ 6334]
Christian Hammond <chipx86@chipx86.com>
parents:
5901
diff
changeset
|
3930 |
6889b89cab90
[gaim-migrate @ 6334]
Christian Hammond <chipx86@chipx86.com>
parents:
5901
diff
changeset
|
3931 g_signal_connect_swapped(G_OBJECT(pane), "focus", |
6889b89cab90
[gaim-migrate @ 6334]
Christian Hammond <chipx86@chipx86.com>
parents:
5901
diff
changeset
|
3932 G_CALLBACK(gtk_widget_grab_focus), |
6889b89cab90
[gaim-migrate @ 6334]
Christian Hammond <chipx86@chipx86.com>
parents:
5901
diff
changeset
|
3933 gtkconv->entry); |
4359 | 3934 } |
3935 | |
3936 gtkconv->tabby = tabby = gtk_hbox_new(FALSE, 5); | |
3937 | |
3938 /* Close button. */ | |
3939 gtkconv->close = gtk_button_new(); | |
3940 gtk_widget_set_size_request(GTK_WIDGET(gtkconv->close), 16, 16); | |
3941 gtk_container_add(GTK_CONTAINER(gtkconv->close), | |
4445 | 3942 gtk_image_new_from_stock(GTK_STOCK_CLOSE, |
3943 GTK_ICON_SIZE_MENU)); | |
4359 | 3944 gtk_button_set_relief(GTK_BUTTON(gtkconv->close), GTK_RELIEF_NONE); |
3945 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->close, | |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
3946 _("Close conversation"), NULL); |
4359 | 3947 |
3948 g_signal_connect(G_OBJECT(gtkconv->close), "clicked", | |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
3949 G_CALLBACK(close_conv_cb), conv); |
4359 | 3950 |
3951 /* Tab label. */ | |
3952 gtkconv->tab_label = gtk_label_new(gaim_conversation_get_title(conv)); | |
3953 #if 0 | |
3954 gtk_misc_set_alignment(GTK_MISC(gtkconv->tab_label), 0.00, 0.5); | |
3955 gtk_misc_set_padding(GTK_MISC(gtkconv->tab_label), 4, 0); | |
3956 #endif | |
3957 | |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3958 |
4359 | 3959 /* Pack it all together. */ |
3960 gtk_box_pack_start(GTK_BOX(tabby), gtkconv->tab_label, TRUE, TRUE, 0); | |
4445 | 3961 gtk_widget_show(gtkconv->tab_label); |
3962 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
|
3963 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3964 if (gaim_prefs_get_bool("/gaim/gtk/conversations/close_on_tabs")) |
4445 | 3965 gtk_widget_show_all(gtkconv->close); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3966 |
4445 | 3967 gtk_widget_show(tabby); |
4359 | 3968 |
3969 | |
3970 /* Add this pane to the conversations notebook. */ | |
3971 gtk_notebook_append_page(GTK_NOTEBOOK(gtkwin->notebook), tab_cont, tabby); | |
3972 gtk_notebook_set_menu_label_text(GTK_NOTEBOOK(gtkwin->notebook), tab_cont, | |
3973 gaim_conversation_get_title(conv)); | |
3974 | |
3975 gtk_widget_show(tab_cont); | |
3976 | |
4818 | 3977 if (gaim_window_get_conversation_count(win) == 1) { |
3978 /* Er, bug in notebooks? Switch to the page manually. */ | |
4359 | 3979 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), 0); |
4851 | 3980 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3981 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3982 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3983 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3984 else |
4818 | 3985 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), TRUE); |
4359 | 3986 |
5204 | 3987 focus_conv = g_list_nth_data(gaim_window_get_conversations(win), |
3988 gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook))); | |
3989 focus_gtkconv = GAIM_GTK_CONVERSATION(focus_conv); | |
3990 gtk_widget_grab_focus(focus_gtkconv->entry); | |
4359 | 3991 |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
3992 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
3993 gaim_gtkconv_update_buddy_icon(conv); |
4359 | 3994 |
3995 if (!new_ui) | |
3996 g_object_unref(gtkconv->tab_cont); | |
3997 | |
3998 if (gaim_window_get_conversation_count(win) == 1) | |
4685 | 3999 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); |
4359 | 4000 } |
4001 | |
4002 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4003 gaim_gtk_remove_conversation(GaimWindow *win, GaimConversation *conv) |
4359 | 4004 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4005 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4006 GaimGtkConversation *gtkconv; |
4359 | 4007 unsigned int index; |
4818 | 4008 GaimConversationType conv_type; |
4009 | |
4010 conv_type = gaim_conversation_get_type(conv); | |
4359 | 4011 index = gaim_conversation_get_index(conv); |
4012 | |
4013 gtkwin = GAIM_GTK_WINDOW(win); | |
4014 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4015 | |
4016 g_object_ref(gtkconv->tab_cont); | |
4017 gtk_object_sink(GTK_OBJECT(gtkconv->tab_cont)); | |
4018 | |
4019 gtk_notebook_remove_page(GTK_NOTEBOOK(gtkwin->notebook), index); | |
4020 | |
4818 | 4021 /* go back to tabless if need be */ |
4022 if (gaim_window_get_conversation_count(win) <= 2) { | |
4023 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4024 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); |
4818 | 4025 } |
4026 | |
4027 | |
4359 | 4028 /* If this window is setup with an inactive gc, regenerate the menu. */ |
4818 | 4029 if (conv_type == GAIM_CONV_IM && |
4359 | 4030 gaim_conversation_get_gc(conv) == NULL) { |
4031 | |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
4032 generate_send_as_items(win, conv); |
4359 | 4033 } |
4034 } | |
4035 | |
4036 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4037 gaim_gtk_move_conversation(GaimWindow *win, GaimConversation *conv, |
4359 | 4038 unsigned int new_index) |
4039 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4040 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4041 GaimGtkConversation *gtkconv; |
4359 | 4042 |
4043 gtkwin = GAIM_GTK_WINDOW(win); | |
4044 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4045 | |
4415
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4046 if (new_index > gaim_conversation_get_index(conv)) |
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4047 new_index--; |
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4048 |
4359 | 4049 gtk_notebook_reorder_child(GTK_NOTEBOOK(gtkwin->notebook), |
4050 gtkconv->tab_cont, new_index); | |
4051 } | |
4052 | |
4053 static int | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4054 gaim_gtk_get_active_index(const GaimWindow *win) |
4359 | 4055 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4056 GaimGtkWindow *gtkwin; |
5680
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4057 int index; |
4359 | 4058 |
4059 gtkwin = GAIM_GTK_WINDOW(win); | |
4060 | |
5680
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4061 index = gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook)); |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4062 |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4063 /* |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4064 * A fix, because the first conversation may be active, but not |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4065 * appear in the notebook just yet. -- ChipX86 |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4066 */ |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4067 return (index == -1 ? 0 : index); |
4359 | 4068 } |
4069 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4070 static GaimWindowUiOps window_ui_ops = |
4359 | 4071 { |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4072 gaim_gtk_get_conversation_ui_ops, |
4359 | 4073 gaim_gtk_new_window, |
4074 gaim_gtk_destroy_window, | |
4075 gaim_gtk_show, | |
4076 gaim_gtk_hide, | |
4077 gaim_gtk_raise, | |
4078 gaim_gtk_flash, | |
4079 gaim_gtk_switch_conversation, | |
4080 gaim_gtk_add_conversation, | |
4081 gaim_gtk_remove_conversation, | |
4082 gaim_gtk_move_conversation, | |
4083 gaim_gtk_get_active_index | |
4084 }; | |
4085 | |
4086 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4087 update_convo_add_button(GaimConversation *conv) |
4359 | 4088 { |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4089 GaimPluginProtocolInfo *prpl_info = NULL; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4090 GaimWindow *win; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4091 GaimGtkWindow *gtkwin; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4092 GaimGtkConversation *gtkconv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
4093 GaimConnection *gc; |
4359 | 4094 GaimConversationType type; |
4095 GtkWidget *parent; | |
4096 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4097 gc = gaim_conversation_get_gc(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4098 win = gaim_conversation_get_window(conv); |
4359 | 4099 type = gaim_conversation_get_type(conv); |
4100 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4101 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4102 parent = gtk_widget_get_parent(gtkconv->u.im->add); |
4103 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4104 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4105 |
4687 | 4106 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
|
4107 gtkconv->u.im->add = |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4108 gaim_gtk_change_text(_("Remove"), gtkconv->u.im->add, |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4109 GTK_STOCK_REMOVE, type); |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4110 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->u.im->add, |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4111 _("Remove the user from your buddy list"), NULL); |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4112 |
4359 | 4113 gtk_widget_set_sensitive(gtkconv->u.im->add, |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4114 (gc != NULL && prpl_info->remove_buddy != NULL)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4115 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4116 if (gaim_window_get_active_conversation(win) == conv) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4117 gtk_widget_show(gtkwin->menu.remove); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4118 gtk_widget_hide(gtkwin->menu.add); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4119 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4120 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4121 else { |
4397
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4122 gtkconv->u.im->add = |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4123 gaim_gtk_change_text(_("Add"), gtkconv->u.im->add, |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4124 GTK_STOCK_ADD, type); |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4125 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->u.im->add, |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4126 _("Add the user to your buddy list"), NULL); |
4359 | 4127 |
4128 gtk_widget_set_sensitive(gtkconv->u.im->add, | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4129 (gc != NULL && prpl_info->add_buddy != NULL)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4130 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4131 if (gaim_window_get_active_conversation(win) == conv) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4132 gtk_widget_show(gtkwin->menu.add); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4133 gtk_widget_hide(gtkwin->menu.remove); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
4134 } |
4359 | 4135 } |
4136 | |
4397
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4137 g_signal_connect(G_OBJECT(gtkconv->u.im->add), "clicked", |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4138 G_CALLBACK(add_cb), conv); |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4139 |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4140 gtk_box_pack_start(GTK_BOX(parent), gtkconv->u.im->add, |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4141 FALSE, FALSE, 0); |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4142 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
|
4143 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
|
4144 gtk_size_group_add_widget(gtkconv->sg, gtkconv->u.im->add); |
4359 | 4145 } |
4146 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4147 GaimWindowUiOps * |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4148 gaim_get_gtk_window_ui_ops(void) |
4359 | 4149 { |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4150 return &window_ui_ops; |
4359 | 4151 } |
4152 | |
4153 /************************************************************************** | |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4154 * Conversation UI operations |
4359 | 4155 **************************************************************************/ |
4156 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4157 gaim_gtkconv_destroy(GaimConversation *conv) |
4359 | 4158 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4159 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); |
4359 | 4160 |
4161 if (gtkconv->dialogs.fg_color != NULL) | |
4162 gtk_widget_destroy(gtkconv->dialogs.fg_color); | |
4163 | |
4164 if (gtkconv->dialogs.bg_color != NULL) | |
4165 gtk_widget_destroy(gtkconv->dialogs.bg_color); | |
4166 | |
4167 if (gtkconv->dialogs.font != NULL) | |
4168 gtk_widget_destroy(gtkconv->dialogs.font); | |
4169 | |
5959 | 4170 if (gtkconv->dialogs.image != NULL) |
4171 gtk_widget_destroy(gtkconv->dialogs.image); | |
4172 | |
4359 | 4173 if (gtkconv->dialogs.smiley != NULL) |
4174 gtk_widget_destroy(gtkconv->dialogs.smiley); | |
4175 | |
4176 if (gtkconv->dialogs.link != NULL) | |
4177 gtk_widget_destroy(gtkconv->dialogs.link); | |
4178 | |
4179 if (gtkconv->dialogs.log != NULL) | |
4180 gtk_widget_destroy(gtkconv->dialogs.log); | |
4181 | |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4182 gtk_widget_destroy(gtkconv->tab_cont); |
4892 | 4183 g_object_unref(gtkconv->tab_cont); |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4184 |
4359 | 4185 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
4755 | 4186 if (gtkconv->u.im->icon_timer != 0) |
4187 g_source_remove(gtkconv->u.im->icon_timer); | |
4188 | |
4359 | 4189 if (gtkconv->u.im->save_icon != NULL) |
4190 gtk_widget_destroy(gtkconv->u.im->save_icon); | |
4191 | |
4192 if (gtkconv->u.im->anim != NULL) | |
4793 | 4193 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); |
4359 | 4194 |
4195 g_free(gtkconv->u.im); | |
4196 } | |
4197 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
4198 g_free(gtkconv->u.chat); | |
4199 } | |
4200 | |
4633 | 4201 gtk_object_sink(GTK_OBJECT(gtkconv->tooltips)); |
4202 | |
4359 | 4203 g_free(gtkconv); |
4204 } | |
4205 | |
4206 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4207 gaim_gtkconv_write_im(GaimConversation *conv, const char *who, |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4208 const char *message, size_t len, int flags, |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4209 time_t mtime) |
4359 | 4210 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4211 GaimGtkConversation *gtkconv; |
4359 | 4212 |
4213 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4214 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4215 if (!(flags & WFLAG_NOLOG) && |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4216 gaim_prefs_get_bool("/gaim/gtk/conversations/im/raise_on_events")) { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4217 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4218 gaim_window_raise(gaim_conversation_get_window(conv)); |
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 |
4382
76223649765b
[gaim-migrate @ 4648]
Christian Hammond <chipx86@chipx86.com>
parents:
4378
diff
changeset
|
4221 /* Play a sound, if specified in prefs. */ |
4359 | 4222 if (gtkconv->make_sound) { |
4223 if (flags & WFLAG_RECV) { | |
4224 if (gtkconv->u.im->a_virgin && | |
5820 | 4225 gaim_prefs_get_bool("/gaim/gtk/sound/enabled/first_im_recv")) { |
4359 | 4226 |
4561 | 4227 gaim_sound_play_event(GAIM_SOUND_FIRST_RECEIVE); |
4359 | 4228 } |
4229 else | |
4561 | 4230 gaim_sound_play_event(GAIM_SOUND_RECEIVE); |
4359 | 4231 } |
4232 else { | |
4561 | 4233 gaim_sound_play_event(GAIM_SOUND_SEND); |
4359 | 4234 } |
4235 } | |
4236 | |
4237 gtkconv->u.im->a_virgin = FALSE; | |
4238 | |
4239 gaim_conversation_write(conv, who, message, len, flags, mtime); | |
4240 } | |
4241 | |
4242 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4243 gaim_gtkconv_write_chat(GaimConversation *conv, const char *who, |
4359 | 4244 const char *message, int flags, time_t mtime) |
4245 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4246 GaimGtkConversation *gtkconv; |
4359 | 4247 |
4248 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4249 | |
4382
76223649765b
[gaim-migrate @ 4648]
Christian Hammond <chipx86@chipx86.com>
parents:
4378
diff
changeset
|
4250 /* Play a sound, if specified in prefs. */ |
4359 | 4251 if (gtkconv->make_sound) { |
4252 if (!(flags & WFLAG_WHISPER) && (flags & WFLAG_SEND)) | |
4561 | 4253 gaim_sound_play_event(GAIM_SOUND_CHAT_YOU_SAY); |
4359 | 4254 else if (flags & WFLAG_RECV) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4255 if ((flags & WFLAG_NICK) && |
6102 | 4256 gaim_prefs_get_bool("/gaim/gtk/sound/enabled/nick_said")) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4257 |
4561 | 4258 gaim_sound_play_event(GAIM_SOUND_CHAT_NICK); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4259 } |
4359 | 4260 else |
4561 | 4261 gaim_sound_play_event(GAIM_SOUND_CHAT_SAY); |
4359 | 4262 } |
4263 } | |
4264 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4265 if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/color_nicks")) |
4359 | 4266 flags |= WFLAG_COLORIZE; |
4267 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4268 /* Raise the window, if specified in prefs. */ |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4269 if (!(flags & WFLAG_NOLOG) && |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4270 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4271 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4272 gaim_window_raise(gaim_conversation_get_window(conv)); |
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 |
4359 | 4275 gaim_conversation_write(conv, who, message, -1, flags, mtime); |
4276 } | |
4277 | |
4278 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4279 gaim_gtkconv_write_conv(GaimConversation *conv, const char *who, |
4359 | 4280 const char *message, size_t length, int flags, |
4281 time_t mtime) | |
4282 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4283 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4284 GaimWindow *win; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
4285 GaimConnection *gc; |
4359 | 4286 int gtk_font_options = 0; |
4287 GString *log_str; | |
4288 FILE *fd; | |
4289 char buf[BUF_LONG]; | |
4290 char buf2[BUF_LONG]; | |
4291 char mdate[64]; | |
4292 char color[10]; | |
4293 char *str; | |
4294 char *with_font_tag; | |
4896 | 4295 char *sml_attrib = NULL; |
4895 | 4296 |
4297 if(length == -1) | |
4298 length = strlen(message) + 1; | |
4299 | |
4359 | 4300 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4301 gc = gaim_conversation_get_gc(conv); | |
4302 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4303 win = gaim_conversation_get_window(conv); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4304 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4305 if (!(flags & WFLAG_NOLOG) && |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4306 ((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT && |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4307 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) || |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4308 (gaim_conversation_get_type(conv) == GAIM_CONV_IM && |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4309 (gaim_prefs_get_bool("/gaim/gtk/conversations/im/raise_on_events") || |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4310 gaim_prefs_get_bool("/gaim/gtk/conversations/im/hide_on_send"))))) { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4311 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4312 gaim_window_show(win); |
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 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4315 |
5133 | 4316 if(time(NULL) > mtime + 20*60) /* show date if older than 20 minutes */ |
4317 strftime(mdate, sizeof(mdate), "%Y-%m-%d %H:%M:%S", localtime(&mtime)); | |
4318 else | |
4319 strftime(mdate, sizeof(mdate), "%H:%M:%S", localtime(&mtime)); | |
4359 | 4320 |
4896 | 4321 if(gc) |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4322 sml_attrib = g_strdup_printf("sml=\"%s\"", gc->prpl->info->name); |
4896 | 4323 |
4359 | 4324 gtk_font_options ^= GTK_IMHTML_NO_COMMENTS; |
4325 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4326 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_colors")) |
4359 | 4327 gtk_font_options ^= GTK_IMHTML_NO_COLOURS; |
4328 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4329 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_fonts")) |
4359 | 4330 gtk_font_options ^= GTK_IMHTML_NO_FONTS; |
4331 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4332 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_font_sizes")) |
4359 | 4333 gtk_font_options ^= GTK_IMHTML_NO_SIZES; |
4334 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4335 if (!gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) |
4359 | 4336 gtk_font_options ^= GTK_IMHTML_RETURN_LOG; |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4337 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4338 if (GAIM_PLUGIN_PROTOCOL_INFO(conv->account->gc->prpl)->options & |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4339 OPT_PROTO_USE_POINTSIZE) { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4340 |
5367 | 4341 gtk_font_options ^= GTK_IMHTML_USE_POINTSIZE; |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4342 } |
4359 | 4343 |
4344 if (flags & WFLAG_SYSTEM) { | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4345 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) |
5329 | 4346 g_snprintf(buf, BUF_LONG, "(%s) <B>%s</B>", |
4359 | 4347 mdate, message); |
4348 else | |
4349 g_snprintf(buf, BUF_LONG, "<B>%s</B>", message); | |
4350 | |
4351 g_snprintf(buf2, sizeof(buf2), | |
5329 | 4352 "<!--(%s) --><B>%s</B><BR>", |
4359 | 4353 mdate, message); |
4354 | |
4355 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, -1, 0); | |
4356 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4357 if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) { |
4359 | 4358 char *t1 = strip_html(buf); |
4359 | |
4360 conv->history = g_string_append(conv->history, t1); | |
4361 conv->history = g_string_append(conv->history, "\n"); | |
4362 | |
4363 g_free(t1); | |
4364 } | |
4365 else { | |
4366 conv->history = g_string_append(conv->history, buf); | |
4367 conv->history = g_string_append(conv->history, "<BR>\n"); | |
4368 } | |
4369 | |
4370 if (!(flags & WFLAG_NOLOG) && gaim_conversation_is_logging(conv)) { | |
4371 | |
4372 char *t1; | |
4373 char nm[256]; | |
4374 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4375 if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) |
4359 | 4376 t1 = strip_html(buf); |
4377 else | |
4378 t1 = buf; | |
4379 | |
4380 if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
4381 g_snprintf(nm, sizeof(nm), "%s.chat", | |
4382 gaim_conversation_get_name(conv)); | |
4383 else | |
4384 strncpy(nm, gaim_conversation_get_name(conv), sizeof(nm)); | |
4385 | |
4386 fd = open_log_file(nm, | |
4387 (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT)); | |
4388 | |
4389 if (fd) { | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4390 if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) |
4359 | 4391 fprintf(fd, "%s\n", t1); |
4392 else | |
4393 fprintf(fd, "%s<BR>\n", t1); | |
4394 | |
4395 fclose(fd); | |
4396 } | |
4397 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4398 if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) |
4359 | 4399 g_free(t1); |
4400 } | |
4401 } | |
4402 else if (flags & WFLAG_NOLOG) { | |
4403 g_snprintf(buf, BUF_LONG, | |
4404 "<B><FONT COLOR=\"#777777\">%s</FONT></B><BR>", | |
4405 message); | |
4406 | |
4407 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf, -1, 0); | |
4408 } | |
4409 else { | |
4895 | 4410 char *new_message = g_memdup(message, length); |
4411 | |
4359 | 4412 if (flags & WFLAG_WHISPER) { |
4413 str = g_malloc(1024); | |
4414 | |
4415 /* If we're whispering, it's not an autoresponse. */ | |
4416 if (meify(new_message, length)) { | |
4417 g_snprintf(str, 1024, "***%s", who); | |
4418 strcpy(color, "#6C2585"); | |
4419 } | |
4420 else { | |
4421 g_snprintf(str, 1024, "*%s*:", who); | |
4422 strcpy(color, "#00FF00"); | |
4423 } | |
4424 } | |
4425 else { | |
4426 if (meify(new_message, length)) { | |
4427 str = g_malloc(1024); | |
4428 | |
4429 if (flags & WFLAG_AUTO) | |
4430 g_snprintf(str, 1024, "%s ***%s", AUTO_RESPONSE, who); | |
4431 else | |
4432 g_snprintf(str, 1024, "***%s", who); | |
4433 | |
4434 if (flags & WFLAG_NICK) | |
4435 strcpy(color, "#AF7F00"); | |
4436 else | |
4437 strcpy(color, "#062585"); | |
4438 } | |
4439 else { | |
4440 str = g_malloc(1024); | |
4441 | |
4442 if (flags & WFLAG_AUTO) | |
4443 g_snprintf(str, 1024, "%s %s", who, AUTO_RESPONSE); | |
4444 else | |
4445 g_snprintf(str, 1024, "%s:", who); | |
4446 | |
4447 if (flags & WFLAG_NICK) | |
4448 strcpy(color, "#AF7F00"); | |
4449 else if (flags & WFLAG_RECV) { | |
4450 if (flags & WFLAG_COLORIZE) { | |
4451 const char *u; | |
4452 int m = 0; | |
4453 | |
4454 for (u = who; *u != '\0'; u++) | |
4455 m += *u; | |
4456 | |
4457 m = m % NUM_NICK_COLORS; | |
4458 | |
4459 strcpy(color, nick_colors[m]); | |
4460 } | |
4461 else | |
4462 strcpy(color, "#A82F2F"); | |
4463 } | |
4464 else if (flags & WFLAG_SEND) | |
4465 strcpy(color, "#16569E"); | |
4466 } | |
4467 } | |
4468 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4469 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) |
4359 | 4470 g_snprintf(buf, BUF_LONG, |
5329 | 4471 "<FONT COLOR=\"%s\" %s>(%s) " |
4896 | 4472 "<B>%s</B></FONT> ", color, |
4473 sml_attrib ? sml_attrib : "", mdate, str); | |
4359 | 4474 else |
4475 g_snprintf(buf, BUF_LONG, | |
4896 | 4476 "<FONT COLOR=\"%s\" %s><B>%s</B></FONT> ", color, |
4477 sml_attrib ? sml_attrib : "", str); | |
4359 | 4478 |
4479 g_snprintf(buf2, BUF_LONG, | |
5329 | 4480 "<FONT COLOR=\"%s\" %s><!--(%s) -->" |
4359 | 4481 "<B>%s</B></FONT> ", |
4896 | 4482 color, sml_attrib ? sml_attrib : "", mdate, str); |
4359 | 4483 |
4484 g_free(str); | |
4485 | |
4486 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, -1, 0); | |
4487 | |
4895 | 4488 if(gc){ |
4896 | 4489 char *pre = g_strdup_printf("<font %s>", sml_attrib ? sml_attrib : ""); |
4895 | 4490 char *post = "</font>"; |
4491 int pre_len = strlen(pre); | |
4492 int post_len = strlen(post); | |
4493 | |
4494 with_font_tag = g_malloc(length + pre_len + post_len + 1); | |
4495 | |
4496 strcpy(with_font_tag, pre); | |
4497 memcpy(with_font_tag + pre_len, new_message, length); | |
4498 strcpy(with_font_tag + pre_len + length, post); | |
4499 | |
4500 length += pre_len + post_len; | |
4501 g_free(pre); | |
4502 } | |
4608 | 4503 else |
4895 | 4504 with_font_tag = g_memdup(new_message, length); |
4359 | 4505 |
4506 log_str = gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), | |
4895 | 4507 with_font_tag, length, gtk_font_options); |
4359 | 4508 |
4509 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", -1, 0); | |
4510 | |
4511 /* 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
|
4512 if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) { |
4359 | 4513 char *t1, *t2; |
4514 | |
4515 t1 = strip_html(buf); | |
4516 t2 = strip_html(new_message); | |
4517 | |
4518 conv->history = g_string_append(conv->history, t1); | |
4519 conv->history = g_string_append(conv->history, t2); | |
4520 conv->history = g_string_append(conv->history, "\n"); | |
4521 | |
4522 g_free(t1); | |
4523 g_free(t2); | |
4524 } | |
4525 else { | |
4526 char *t1, *t2; | |
4527 | |
4528 t1 = html_logize(buf); | |
4529 t2 = html_logize(new_message); | |
4530 | |
4531 conv->history = g_string_append(conv->history, t1); | |
4532 conv->history = g_string_append(conv->history, t2); | |
4533 conv->history = g_string_append(conv->history, "\n"); | |
4534 conv->history = g_string_append(conv->history, log_str->str); | |
4535 conv->history = g_string_append(conv->history, "<BR>\n"); | |
4536 | |
4537 g_free(t1); | |
4538 g_free(t2); | |
4539 } | |
4540 | |
4541 /* XXX This needs to be updated for the new length argument. */ | |
4542 if (gaim_conversation_is_logging(conv)) { | |
4543 char *t1, *t2; | |
4544 char nm[256]; | |
4545 | |
4546 if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
4547 g_snprintf(nm, sizeof(nm), "%s.chat", | |
4548 gaim_conversation_get_name(conv)); | |
4549 else | |
4550 strncpy(nm, gaim_conversation_get_name(conv), sizeof(nm)); | |
4551 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4552 if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) { |
4359 | 4553 t1 = strip_html(buf); |
4554 t2 = strip_html(with_font_tag); | |
4555 } | |
4556 else { | |
4557 t1 = html_logize(buf); | |
4558 t2 = html_logize(with_font_tag); | |
4559 } | |
4560 | |
4561 fd = open_log_file(nm, | |
4562 (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT)); | |
4563 | |
4564 if (fd) { | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4565 if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) |
4359 | 4566 fprintf(fd, "%s%s\n", t1, t2); |
4567 else { | |
4568 fprintf(fd, "%s%s%s<BR>\n", t1, t2, log_str->str); | |
4569 g_string_free(log_str, TRUE); | |
4570 } | |
4571 | |
4572 fclose(fd); | |
4573 } | |
4574 | |
4575 g_free(t1); | |
4576 g_free(t2); | |
4577 } | |
4578 | |
4579 g_free(with_font_tag); | |
4580 g_free(new_message); | |
4581 } | |
6062 | 4582 |
5012 | 4583 if(sml_attrib) |
4584 g_free(sml_attrib); | |
4359 | 4585 } |
4586 | |
4587 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4588 gaim_gtkconv_chat_add_user(GaimConversation *conv, const char *user) |
4359 | 4589 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4590 GaimChat *chat; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4591 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4592 GaimGtkChatPane *gtkchat; |
4359 | 4593 char tmp[BUF_LONG]; |
4594 int num_users; | |
4595 int pos; | |
4596 | |
4597 chat = GAIM_CHAT(conv); | |
4598 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4599 gtkchat = gtkconv->u.chat; | |
4600 | |
4601 num_users = g_list_length(gaim_chat_get_users(chat)); | |
4602 | |
4603 g_snprintf(tmp, sizeof(tmp), | |
4604 ngettext("%d person in room", "%d people in room", | |
4605 num_users), | |
4606 num_users); | |
4607 | |
4608 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); | |
4609 | |
4610 if (gtkconv->make_sound) | |
4561 | 4611 gaim_sound_play_event(GAIM_SOUND_CHAT_JOIN); |
4359 | 4612 |
4613 pos = g_list_index(gaim_chat_get_users(chat), user); | |
4614 | |
4615 add_chat_buddy_common(conv, user, pos); | |
4616 } | |
4617 | |
4618 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4619 gaim_gtkconv_chat_rename_user(GaimConversation *conv, const char *old_name, |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4620 const char *new_name) |
4359 | 4621 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4622 GaimChat *chat; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4623 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4624 GaimGtkChatPane *gtkchat; |
4359 | 4625 GtkTreeIter iter; |
4626 GtkTreeModel *model; | |
4627 GList *names; | |
4628 int pos; | |
4629 int f = 1; | |
4630 | |
4631 chat = GAIM_CHAT(conv); | |
4632 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4633 gtkchat = gtkconv->u.chat; | |
4634 | |
4635 for (names = gaim_chat_get_users(chat); | |
4636 names != NULL; | |
4637 names = names->next) { | |
4638 | |
4639 char *u = (char *)names->data; | |
4640 | |
4793 | 4641 if (!gaim_utf8_strcasecmp(u, old_name)) { |
4359 | 4642 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
4643 | |
4644 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
4645 break; | |
4646 | |
4647 while (f != 0) { | |
4648 char *val; | |
4649 | |
4650 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &val, -1); | |
4651 | |
4793 | 4652 if (!gaim_utf8_strcasecmp(old_name, val)) { |
4359 | 4653 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
4640 | 4654 break; |
4655 } | |
4359 | 4656 |
4657 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
4658 | |
4659 g_free(val); | |
4660 } | |
4661 | |
4662 break; | |
4663 } | |
4664 } | |
4665 | |
4666 if (!names) | |
4667 return; | |
4668 | |
4669 pos = g_list_index(gaim_chat_get_users(chat), new_name); | |
4670 | |
4671 add_chat_buddy_common(conv, new_name, pos); | |
4672 } | |
4673 | |
4674 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4675 gaim_gtkconv_chat_remove_user(GaimConversation *conv, const char *user) |
4359 | 4676 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4677 GaimChat *chat; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4678 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4679 GaimGtkChatPane *gtkchat; |
4359 | 4680 GtkTreeIter iter; |
4681 GtkTreeModel *model; | |
4682 GList *names; | |
4683 char tmp[BUF_LONG]; | |
4684 int num_users; | |
4685 int f = 1; | |
4686 | |
4687 chat = GAIM_CHAT(conv); | |
4688 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4689 gtkchat = gtkconv->u.chat; | |
4690 | |
4691 num_users = g_list_length(gaim_chat_get_users(chat)) - 1; | |
4692 | |
4693 for (names = gaim_chat_get_users(chat); | |
4694 names != NULL; | |
4695 names = names->next) { | |
4696 | |
4697 char *u = (char *)names->data; | |
4698 | |
4793 | 4699 if (!gaim_utf8_strcasecmp(u, user)) { |
4359 | 4700 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
4701 | |
4702 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
4703 break; | |
4704 | |
4705 while (f != 0) { | |
4706 char *val; | |
4707 | |
4708 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &val, -1); | |
4709 | |
4793 | 4710 if (!gaim_utf8_strcasecmp(user, val)) |
4359 | 4711 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
4712 | |
4713 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
4714 | |
4715 g_free(val); | |
4716 } | |
4717 | |
4718 break; | |
4719 } | |
4720 } | |
4721 | |
4722 if (names == NULL) | |
4723 return; | |
4724 | |
4725 g_snprintf(tmp, sizeof(tmp), | |
4726 ngettext("%d person in room", "%d people in room", | |
4727 num_users), num_users); | |
4728 | |
4729 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); | |
4730 | |
4731 if (gtkconv->make_sound) | |
4561 | 4732 gaim_sound_play_event(GAIM_SOUND_CHAT_LEAVE); |
4359 | 4733 } |
4734 | |
4735 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4736 gaim_gtkconv_set_title(GaimConversation *conv, const char *title) |
4359 | 4737 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4738 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4739 GaimWindow *win; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4740 GaimGtkWindow *gtkwin; |
4681 | 4741 |
4742 win = gaim_conversation_get_window(conv); | |
4743 gtkwin = GAIM_GTK_WINDOW(win); | |
4359 | 4744 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4745 | |
4746 gtk_label_set_text(GTK_LABEL(gtkconv->tab_label), title); | |
4681 | 4747 |
4748 if(conv == gaim_window_get_active_conversation(win)) | |
4749 gtk_window_set_title(GTK_WINDOW(gtkwin->window), title); | |
4359 | 4750 } |
4751 | |
4752 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4753 gaim_gtkconv_updated(GaimConversation *conv, GaimConvUpdateType type) |
4359 | 4754 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4755 GaimWindow *win; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4756 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4757 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4758 GaimGtkChatPane *gtkchat; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4759 GaimChat *chat; |
4359 | 4760 |
4761 win = gaim_conversation_get_window(conv); | |
4736 | 4762 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4763 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4764 | |
4491 | 4765 if (type == GAIM_CONV_UPDATE_ACCOUNT) { |
4359 | 4766 gaim_conversation_autoset_title(conv); |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
4767 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
4768 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
4769 gaim_gtkconv_update_buddy_icon(conv); |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
4770 |
4359 | 4771 gaim_gtkconv_update_buttons_by_protocol(conv); |
4772 | |
4685 | 4773 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); |
4359 | 4774 |
4775 smiley_themeize(gtkconv->imhtml); | |
4776 } | |
4777 else if (type == GAIM_CONV_UPDATE_TYPING || | |
4778 type == GAIM_CONV_UPDATE_UNSEEN) { | |
4779 GtkStyle *style; | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4780 GaimIm *im = NULL; |
4359 | 4781 |
4736 | 4782 |
4359 | 4783 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
4784 im = GAIM_IM(conv); | |
4785 | |
4786 style = gtk_style_new(); | |
4787 | |
4788 if (!GTK_WIDGET_REALIZED(gtkconv->tab_label)) | |
4789 gtk_widget_realize(gtkconv->tab_label); | |
4790 | |
4757 | 4791 pango_font_description_free(style->font_desc); |
4635 | 4792 style->font_desc = pango_font_description_copy( |
4793 gtk_widget_get_style(gtkconv->tab_label)->font_desc); | |
4359 | 4794 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
4795 if (im != NULL && gaim_im_get_typing_state(im) == GAIM_TYPING) { |
4577 | 4796 style->fg[GTK_STATE_NORMAL].red = 0x4646; |
4797 style->fg[GTK_STATE_NORMAL].green = 0xA0A0; | |
4798 style->fg[GTK_STATE_NORMAL].blue = 0x4646; | |
4799 style->fg[GTK_STATE_ACTIVE] = style->fg[GTK_STATE_NORMAL]; | |
4359 | 4800 } |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
4801 else if (im != NULL && gaim_im_get_typing_state(im) == GAIM_TYPED) { |
4577 | 4802 style->fg[GTK_STATE_NORMAL].red = 0xD1D1; |
4803 style->fg[GTK_STATE_NORMAL].green = 0x9494; | |
4804 style->fg[GTK_STATE_NORMAL].blue = 0x0C0C; | |
4805 style->fg[GTK_STATE_ACTIVE] = style->fg[GTK_STATE_NORMAL]; | |
4359 | 4806 } |
4807 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_NICK) { | |
4577 | 4808 style->fg[GTK_STATE_ACTIVE].red = 0x3131; |
4809 style->fg[GTK_STATE_ACTIVE].green = 0x4E4E; | |
4810 style->fg[GTK_STATE_ACTIVE].blue = 0x6C6C; | |
4578 | 4811 style->fg[GTK_STATE_NORMAL] = style->fg[GTK_STATE_ACTIVE]; |
4359 | 4812 } |
4813 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_TEXT) { | |
4577 | 4814 style->fg[GTK_STATE_ACTIVE].red = 0xDFDF; |
4815 style->fg[GTK_STATE_ACTIVE].green = 0x4242; | |
4816 style->fg[GTK_STATE_ACTIVE].blue = 0x1E1E; | |
4578 | 4817 style->fg[GTK_STATE_NORMAL] = style->fg[GTK_STATE_ACTIVE]; |
4359 | 4818 } |
4819 | |
4820 gtk_widget_set_style(gtkconv->tab_label, style); | |
4635 | 4821 g_object_unref(G_OBJECT(style)); |
4736 | 4822 |
4812 | 4823 if(conv == gaim_window_get_active_conversation(win)) { |
4736 | 4824 update_typing_icon(conv); |
4825 } | |
4826 | |
4359 | 4827 } |
4828 else if (type == GAIM_CONV_UPDATE_TOPIC) { | |
4829 chat = GAIM_CHAT(conv); | |
4830 gtkchat = gtkconv->u.chat; | |
4831 | |
4832 gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), | |
4833 gaim_chat_get_topic(chat)); | |
4834 } | |
4835 else if (type == GAIM_CONV_ACCOUNT_ONLINE || | |
4836 type == GAIM_CONV_ACCOUNT_OFFLINE) { | |
4837 | |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
4838 generate_send_as_items(win, NULL); |
4359 | 4839 } |
4397
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4840 else if(type == GAIM_CONV_UPDATE_ADD || |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4841 type == GAIM_CONV_UPDATE_REMOVE) { |
4736 | 4842 |
4397
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4843 update_convo_add_button(conv); |
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
4844 } |
4359 | 4845 } |
4846 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4847 static GaimConversationUiOps conversation_ui_ops = |
4359 | 4848 { |
4849 gaim_gtkconv_destroy, /* destroy_conversation */ | |
4850 gaim_gtkconv_write_chat, /* write_chat */ | |
4851 gaim_gtkconv_write_im, /* write_im */ | |
4852 gaim_gtkconv_write_conv, /* write_conv */ | |
4853 gaim_gtkconv_chat_add_user, /* chat_add_user */ | |
4854 gaim_gtkconv_chat_rename_user, /* chat_rename_user */ | |
4855 gaim_gtkconv_chat_remove_user, /* chat_remove_user */ | |
4856 gaim_gtkconv_set_title, /* set_title */ | |
4857 NULL, /* update_progress */ | |
4858 gaim_gtkconv_updated /* updated */ | |
4859 }; | |
4860 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4861 GaimConversationUiOps * |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4862 gaim_get_gtk_conversation_ui_ops(void) |
4359 | 4863 { |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4864 return &conversation_ui_ops; |
4359 | 4865 } |
4866 | |
4867 /************************************************************************** | |
4868 * Public conversation utility functions | |
4869 **************************************************************************/ | |
4870 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4871 remove_icon(GaimGtkConversation *gtkconv) |
4359 | 4872 { |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
4873 g_return_if_fail(gtkconv != NULL); |
4359 | 4874 |
4875 if (gtkconv->u.im->icon != NULL) | |
4876 gtk_container_remove(GTK_CONTAINER(gtkconv->bbox), | |
4877 gtkconv->u.im->icon->parent->parent); | |
4878 | |
4879 if (gtkconv->u.im->anim != NULL) | |
4793 | 4880 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); |
4359 | 4881 |
4882 if (gtkconv->u.im->icon_timer != 0) | |
4883 g_source_remove(gtkconv->u.im->icon_timer); | |
4884 | |
4885 if (gtkconv->u.im->iter != NULL) | |
4886 g_object_unref(G_OBJECT(gtkconv->u.im->iter)); | |
4887 | |
4888 gtkconv->u.im->icon_timer = 0; | |
4889 gtkconv->u.im->icon = NULL; | |
4890 gtkconv->u.im->anim = NULL; | |
4891 gtkconv->u.im->iter = NULL; | |
4892 } | |
4893 | |
4894 static gboolean | |
4895 redraw_icon(gpointer data) | |
4896 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4897 GaimConversation *conv = (GaimConversation *)data; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4898 GaimGtkConversation *gtkconv; |
4359 | 4899 |
4900 GdkPixbuf *buf; | |
4901 GdkPixbuf *scale; | |
4902 GdkPixmap *pm; | |
4903 GdkBitmap *bm; | |
4904 gint delay; | |
4905 | |
4906 if (!g_list_find(gaim_get_ims(), conv)) { | |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
4907 gaim_debug(GAIM_DEBUG_WARNING, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
4908 "Conversation not found in redraw_icon. I think this " |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
4909 "is a bug.\n"); |
4359 | 4910 return FALSE; |
4911 } | |
4912 | |
4913 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4914 | |
4915 gdk_pixbuf_animation_iter_advance(gtkconv->u.im->iter, NULL); | |
4916 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); | |
4917 | |
4918 scale = gdk_pixbuf_scale_simple(buf, | |
4919 MAX(gdk_pixbuf_get_width(buf) * SCALE(gtkconv->u.im->anim) / | |
4920 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), | |
4921 MAX(gdk_pixbuf_get_height(buf) * SCALE(gtkconv->u.im->anim) / | |
4922 gdk_pixbuf_animation_get_height(gtkconv->u.im->anim), 1), | |
4923 GDK_INTERP_NEAREST); | |
4924 | |
4925 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); | |
4793 | 4926 g_object_unref(G_OBJECT(scale)); |
4635 | 4927 gtk_image_set_from_pixmap(GTK_IMAGE(gtkconv->u.im->icon), pm, bm); |
4793 | 4928 g_object_unref(G_OBJECT(pm)); |
4359 | 4929 gtk_widget_queue_draw(gtkconv->u.im->icon); |
4930 | |
4931 if (bm) | |
4793 | 4932 g_object_unref(G_OBJECT(bm)); |
4359 | 4933 |
4934 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter) / 10; | |
4935 | |
4936 gtkconv->u.im->icon_timer = g_timeout_add(delay * 10, redraw_icon, conv); | |
4937 | |
4938 return FALSE; | |
4939 } | |
4940 | |
4941 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4942 start_anim(GtkObject *obj, GaimConversation *conv) |
4359 | 4943 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4944 GaimGtkConversation *gtkconv; |
4359 | 4945 int delay; |
4946 | |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
4947 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
4359 | 4948 return; |
4949 | |
4950 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4951 | |
6016 | 4952 if (gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim)) |
4953 return; | |
4954 | |
4359 | 4955 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter) / 10; |
4956 | |
4957 if (gtkconv->u.im->anim) | |
4958 gtkconv->u.im->icon_timer = g_timeout_add(delay * 10, redraw_icon, | |
4959 conv); | |
4960 } | |
4961 | |
4962 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4963 stop_anim(GtkObject *obj, GaimConversation *conv) |
4359 | 4964 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4965 GaimGtkConversation *gtkconv; |
4359 | 4966 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
4967 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
4359 | 4968 return; |
4969 | |
4970 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4971 | |
4972 if (gtkconv->u.im->icon_timer != 0) | |
4973 g_source_remove(gtkconv->u.im->icon_timer); | |
4974 | |
4975 gtkconv->u.im->icon_timer = 0; | |
4976 } | |
4977 | |
4978 static gboolean | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4979 icon_menu(GtkObject *obj, GdkEventButton *e, GaimConversation *conv) |
4359 | 4980 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4981 GaimGtkConversation *gtkconv; |
4359 | 4982 static GtkWidget *menu = NULL; |
4983 GtkWidget *button; | |
4984 | |
4985 if (e->button != 3 || e->type != GDK_BUTTON_PRESS) | |
4986 return FALSE; | |
4987 | |
4988 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4989 | |
4990 /* | |
4991 * If a menu already exists, destroy it before creating a new one, | |
4992 * thus freeing-up the memory it occupied. | |
4993 */ | |
4994 if (menu != NULL) | |
4995 gtk_widget_destroy(menu); | |
4996 | |
4997 menu = gtk_menu_new(); | |
4998 | |
4999 if (gtkconv->u.im->icon_timer) { | |
5000 button = gtk_menu_item_new_with_label(_("Disable Animation")); | |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
5001 g_signal_connect(G_OBJECT(button), "activate", |
4359 | 5002 G_CALLBACK(stop_anim), conv); |
5003 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
5004 gtk_widget_show(button); | |
5005 } | |
5006 else if (gtkconv->u.im->anim && | |
5007 !(gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim))) | |
5008 { | |
5009 button = gtk_menu_item_new_with_label(_("Enable Animation")); | |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
5010 g_signal_connect(G_OBJECT(button), "activate", |
4359 | 5011 G_CALLBACK(start_anim), conv); |
5012 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
5013 gtk_widget_show(button); | |
5014 } | |
5015 | |
5016 button = gtk_menu_item_new_with_label(_("Hide Icon")); | |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
5017 g_signal_connect_swapped(G_OBJECT(button), "activate", |
4515
9b9737a00a96
[gaim-migrate @ 4793]
Christian Hammond <chipx86@chipx86.com>
parents:
4513
diff
changeset
|
5018 G_CALLBACK(remove_icon), gtkconv); |
4359 | 5019 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); |
5020 gtk_widget_show(button); | |
5021 | |
5022 button = gtk_menu_item_new_with_label(_("Save Icon As...")); | |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
5023 g_signal_connect(G_OBJECT(button), "activate", |
4359 | 5024 G_CALLBACK(gaim_gtk_save_icon_dialog), conv); |
5025 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
5026 gtk_widget_show(button); | |
5027 | |
5028 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, e->button, e->time); | |
5029 | |
5030 return TRUE; | |
5031 } | |
5032 | |
5033 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5034 gaim_gtkconv_update_buddy_icon(GaimConversation *conv) |
4359 | 5035 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5036 GaimGtkConversation *gtkconv; |
4359 | 5037 |
5038 char filename[256]; | |
5039 FILE *file; | |
5040 GError *err = NULL; | |
5462
8355eeeb52a3
[gaim-migrate @ 5853]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
5041 gboolean animate = TRUE; |
4359 | 5042 |
4757 | 5043 struct buddy *buddy; |
5044 | |
4359 | 5045 void *data; |
5046 int len, delay; | |
5047 | |
5048 GdkPixbuf *buf; | |
5049 | |
5050 GtkWidget *event; | |
5051 GtkWidget *frame; | |
5052 GdkPixbuf *scale; | |
5053 GdkPixmap *pm; | |
5054 GdkBitmap *bm; | |
5055 int sf = 0; | |
5056 | |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5057 g_return_if_fail(conv != NULL); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5058 g_return_if_fail(GAIM_IS_GTK_CONVERSATION(conv)); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5059 g_return_if_fail(gaim_conversation_get_type(conv) == GAIM_CONV_IM); |
4359 | 5060 |
5061 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5062 | |
5462
8355eeeb52a3
[gaim-migrate @ 5853]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
5063 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
|
5064 animate = FALSE; |
8355eeeb52a3
[gaim-migrate @ 5853]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
5065 |
4359 | 5066 remove_icon(gtkconv); |
5067 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5068 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/im/show_buddy_icons")) |
4359 | 5069 return; |
5070 | |
5071 if (gaim_conversation_get_gc(conv) == NULL) | |
5072 return; | |
5073 | |
4793 | 5074 if(gtkconv->u.im->anim) |
5075 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); | |
5076 | |
4757 | 5077 if((buddy = gaim_find_buddy(gaim_conversation_get_account(conv), |
5078 gaim_conversation_get_name(conv))) != NULL) { | |
5079 char *file = gaim_buddy_get_setting(buddy, "buddy_icon"); | |
5080 if(file) { | |
5081 gtkconv->u.im->anim = gdk_pixbuf_animation_new_from_file(file, &err); | |
5082 g_free(file); | |
5083 } | |
5084 } else { | |
5085 data = get_icon_data(gaim_conversation_get_gc(conv), | |
5086 normalize(gaim_conversation_get_name(conv)), | |
5087 &len); | |
5088 | |
5089 if (!data) | |
5090 return; | |
5091 | |
5092 /* this is such an evil hack, i don't know why i'm even considering it. | |
5093 * we'll do it differently when gdk-pixbuf-loader isn't leaky anymore. */ | |
5094 g_snprintf(filename, sizeof(filename), | |
5095 "%s" G_DIR_SEPARATOR_S "gaimicon-%s.%d", | |
5096 g_get_tmp_dir(), gaim_conversation_get_name(conv), getpid()); | |
5097 | |
5098 if (!(file = fopen(filename, "wb"))) | |
5099 return; | |
5100 | |
5101 fwrite(data, 1, len, file); | |
5102 fclose(file); | |
5103 | |
5104 gtkconv->u.im->anim = gdk_pixbuf_animation_new_from_file(filename, &err); | |
5105 /* make sure we remove the file as soon as possible */ | |
5106 unlink(filename); | |
5107 } | |
4359 | 5108 |
5109 if (err) { | |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5110 gaim_debug(GAIM_DEBUG_ERROR, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5111 "Buddy icon error: %s\n", err->message); |
4359 | 5112 g_error_free(err); |
5113 } | |
5114 | |
5115 | |
5116 if (!gtkconv->u.im->anim) | |
5117 return; | |
5118 | |
4793 | 5119 if(gtkconv->u.im->iter) |
5120 g_object_unref(G_OBJECT(gtkconv->u.im->iter)); | |
5121 | |
4359 | 5122 if (gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim)) { |
5123 gtkconv->u.im->iter = NULL; | |
5124 delay = 0; | |
5125 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); | |
5126 } else { | |
5127 gtkconv->u.im->iter = | |
5128 gdk_pixbuf_animation_get_iter(gtkconv->u.im->anim, NULL); | |
5129 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); | |
5130 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter); | |
5131 delay = delay / 10; | |
5132 } | |
5133 | |
5134 sf = SCALE(gtkconv->u.im->anim); | |
5135 scale = gdk_pixbuf_scale_simple(buf, | |
5136 MAX(gdk_pixbuf_get_width(buf) * sf / | |
5137 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), | |
5138 MAX(gdk_pixbuf_get_height(buf) * sf / | |
5139 gdk_pixbuf_animation_get_height(gtkconv->u.im->anim), 1), | |
5140 GDK_INTERP_NEAREST); | |
5141 | |
5142 if (delay) | |
5143 gtkconv->u.im->icon_timer = g_timeout_add(delay * 10, redraw_icon, | |
5144 conv); | |
5145 | |
5146 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); | |
4793 | 5147 g_object_unref(G_OBJECT(scale)); |
4359 | 5148 |
5149 frame = gtk_frame_new(NULL); | |
5150 gtk_frame_set_shadow_type(GTK_FRAME(frame), | |
5151 (bm ? GTK_SHADOW_NONE : GTK_SHADOW_IN)); | |
5152 gtk_box_pack_start(GTK_BOX(gtkconv->bbox), frame, FALSE, FALSE, 5); | |
5153 gtk_box_reorder_child(GTK_BOX(gtkconv->bbox), frame, 0); | |
5154 gtk_widget_show(frame); | |
5155 | |
5156 event = gtk_event_box_new(); | |
5157 gtk_container_add(GTK_CONTAINER(frame), event); | |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
5158 g_signal_connect(G_OBJECT(event), "button-press-event", |
4359 | 5159 G_CALLBACK(icon_menu), conv); |
5160 gtk_widget_show(event); | |
5161 | |
4635 | 5162 gtkconv->u.im->icon = gtk_image_new_from_pixmap(pm, bm); |
4359 | 5163 gtk_widget_set_size_request(gtkconv->u.im->icon, sf, sf); |
5164 gtk_container_add(GTK_CONTAINER(event), gtkconv->u.im->icon); | |
5165 gtk_widget_show(gtkconv->u.im->icon); | |
5166 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5167 if (!animate || |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5168 !gaim_prefs_get_bool("/gaim/gtk/conversations/im/animate_buddy_icons")) { |
4359 | 5169 stop_anim(NULL, conv); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5170 } |
4359 | 5171 |
4793 | 5172 g_object_unref(G_OBJECT(pm)); |
4359 | 5173 |
5174 if (bm) | |
4793 | 5175 g_object_unref(G_OBJECT(bm)); |
4359 | 5176 } |
5177 | |
5178 void | |
5179 gaim_gtkconv_update_font_buttons(void) | |
5180 { | |
5181 GList *l; | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5182 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5183 GaimGtkConversation *gtkconv; |
4359 | 5184 |
5185 for (l = gaim_get_ims(); l != NULL; l = l->next) { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5186 conv = (GaimConversation *)l->data; |
4359 | 5187 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5188 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
4359 | 5189 continue; |
5190 | |
5191 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5192 | |
5193 if (gtkconv->toolbar.bold != NULL) | |
5194 gtk_widget_set_sensitive(gtkconv->toolbar.bold, | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5195 !gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold")); |
4359 | 5196 |
5197 if (gtkconv->toolbar.italic != NULL) | |
5198 gtk_widget_set_sensitive(gtkconv->toolbar.italic, | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5199 !gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic")); |
4359 | 5200 |
5201 if (gtkconv->toolbar.underline != NULL) | |
5202 gtk_widget_set_sensitive(gtkconv->toolbar.underline, | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5203 !gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline")); |
4359 | 5204 } |
5205 } | |
5206 | |
5207 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5208 gaim_gtkconv_update_font_colors(GaimConversation *conv) |
4421 | 5209 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5210 GaimGtkConversation *gtkconv; |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5211 |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5212 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5213 return; |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5214 |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5215 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5216 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5217 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5218 >kconv->fg_color); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5219 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5220 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5221 >kconv->bg_color); |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5222 } |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5223 |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5224 void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5225 gaim_gtkconv_update_font_face(GaimConversation *conv) |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5226 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5227 GaimGtkConversation *gtkconv; |
6141 | 5228 |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5229 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5230 return; |
6141 | 5231 |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5232 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
5233 |
6141 | 5234 strncpy(gtkconv->fontface, |
5235 gaim_prefs_get_string("/gaim/gtk/conversations/font_face"), | |
5236 sizeof(gtkconv->fontface)); | |
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 } |