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