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