Mercurial > pidgin
annotate src/gtkconv.c @ 7949:b356e2a9d7fc
[gaim-migrate @ 8623]
Add scrollbars to the text input widgets for away messages and conversations.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 29 Dec 2003 05:14:16 +0000 |
parents | 4eb96e3cf633 |
children | fb66c2ee4446 |
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> |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
6 * |
4359 | 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> |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
30 # ifdef _WIN32 |
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
31 # include "wspell.h" |
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
32 # endif |
4359 | 33 #endif |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
34 |
4359 | 35 #include <gdk/gdkkeysyms.h> |
6982 | 36 #include <locale.h> |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
37 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
38 #include "debug.h" |
6982 | 39 #include "imgstore.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
40 #include "log.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
41 #include "multi.h" |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5402
diff
changeset
|
42 #include "notify.h" |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
43 #include "prefs.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
44 #include "prpl.h" |
6038 | 45 #include "request.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
46 #include "sound.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
47 #include "util.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
48 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
49 #include "dnd-hints.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
50 #include "gtkblist.h" |
5717 | 51 #include "gtkconv.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
52 #include "gtkimhtml.h" |
7431 | 53 #include "gtklog.h" |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
54 #include "gtkpounce.h" |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
55 #include "gtkprivacy.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
56 #include "gtkutils.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
57 #include "stock.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
58 |
5717 | 59 #include "ui.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
60 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
61 /* XXX */ |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
62 #include "gaim.h" |
4359 | 63 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
64 #define AUTO_RESPONSE "<AUTO-REPLY> : " |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
65 |
7854 | 66 #define SEND_COLOR "#267726" |
7855 | 67 #define RECV_COLOR "#A82F2F" |
7854 | 68 |
4359 | 69 static char nick_colors[][8] = { |
70 "#ba55d3", /* Medium Orchid */ | |
71 "#ee82ee", /* Violet */ | |
72 "#c715b4", /* Medium Violet Red */ | |
73 "#ff69b4", /* Hot Pink */ | |
74 "#ff6347", /* Tomato */ | |
75 "#fa8c00", /* Dark Orange */ | |
76 "#fa8072", /* Salmon */ | |
77 "#b22222", /* Fire Brick */ | |
78 "#f4a460", /* Sandy Brown */ | |
79 "#cd5c5c", /* Indian Red */ | |
80 "#bc8f8f", /* Rosy Brown */ | |
81 "#f0e68c", /* Khaki */ | |
82 "#bdb76b", /* Dark Khaki */ | |
83 "#228b22", /* Forest Green */ | |
84 "#9acd32", /* Yellow Green */ | |
85 "#32cd32", /* Lime Green */ | |
7755 | 86 "#3cb371", /* Medium Sea Green (Medium Sea Green?! What are we women?!) */ |
4359 | 87 "#2e8b57", /* Sea Green */ |
88 "#8fbc8f", /* Dark Sea Green */ | |
89 "#66cdaa", /* Medium Aquamarine */ | |
90 "#5f9ea0", /* Cadet Blue */ | |
91 "#48d1cc", /* Medium Turquoise */ | |
92 "#00ced1", /* Dark Turquoise */ | |
93 "#4682b4", /* Stell Blue */ | |
94 "#00bfff", /* Deep Sky Blue */ | |
95 "#1690ff", /* Dodger Blue */ | |
96 "#4169ff", /* Royal Blue */ | |
97 "#6a5acd", /* Slate Blue */ | |
98 "#6495ed", /* Cornflower Blue */ | |
99 "#708090", /* Slate gray */ | |
6291 | 100 "#2f4f4f", /* Dark Slate Gray */ |
101 "#ff8c00", /* Dark Orange */ | |
4359 | 102 }; |
6291 | 103 |
4359 | 104 #define NUM_NICK_COLORS (sizeof(nick_colors) / sizeof(*nick_colors)) |
105 | |
106 #define SCALE(x) \ | |
107 ((gdk_pixbuf_animation_get_width(x) <= 48 && \ | |
108 gdk_pixbuf_animation_get_height(x) <= 48) ? 48 : 50) | |
109 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
110 typedef struct |
4359 | 111 { |
112 GtkWidget *window; | |
113 | |
114 GtkWidget *entry; | |
115 GtkWidget *message; | |
116 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
117 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
118 |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
119 } InviteBuddyInfo; |
4359 | 120 |
121 static GtkWidget *invite_dialog = NULL; | |
122 | |
123 /* Prototypes. <-- because Paco-Paco hates this comment. */ | |
124 static void check_everything(GtkTextBuffer *buffer); | |
4685 | 125 static void set_toggle(GtkWidget *tb, gboolean active); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
126 static void move_next_tab(GaimConversation *conv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
127 static void do_bold(GtkWidget *bold, GaimGtkConversation *gtkconv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
128 static void do_italic(GtkWidget *italic, GaimGtkConversation *gtkconv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
129 static void do_underline(GtkWidget *underline, GaimGtkConversation *gtkconv); |
7242
59ffe137176d
[gaim-migrate @ 7817]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7222
diff
changeset
|
130 static void do_small(GtkWidget *smalltb, GaimGtkConversation *gtkconv); |
59ffe137176d
[gaim-migrate @ 7817]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7222
diff
changeset
|
131 static void do_big(GtkWidget *large, GaimGtkConversation *gtkconv); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
132 static void toggle_font(GtkWidget *font, GaimConversation *conv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
133 static void toggle_fg_color(GtkWidget *color, GaimConversation *conv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
134 static void toggle_bg_color(GtkWidget *color, GaimConversation *conv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
135 static void got_typing_keypress(GaimConversation *conv, gboolean first); |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
136 static GList *generate_invite_user_names(GaimConnection *gc); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
137 static void add_chat_buddy_common(GaimConversation *conv, |
4359 | 138 const char *name, int pos); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
139 static void tab_complete(GaimConversation *conv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
140 static void update_typing_icon(GaimConversation *conv); |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
141 static gboolean update_send_as_selection(GaimConvWindow *win); |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
142 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
|
143 static void save_convo(GtkWidget *save, GaimConversation *c); |
6440 | 144 static void update_tab_icon(GaimConversation *conv); |
4359 | 145 |
146 /************************************************************************** | |
147 * Callbacks | |
148 **************************************************************************/ | |
149 static void | |
6038 | 150 do_save_convo(GtkWidget *wid) |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
151 { |
6039 | 152 GaimConversation *c = g_object_get_data(G_OBJECT(GTK_FILE_SELECTION(wid)->ok_button), |
6038 | 153 "gaim_conversation"); |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
154 const char *filename; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
155 FILE *fp; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
156 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
157 filename = gtk_file_selection_get_filename(GTK_FILE_SELECTION(wid)); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
158 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
159 if (!((gaim_conversation_get_type(c) != GAIM_CONV_CHAT && |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
160 g_list_find(gaim_get_ims(), c)) || |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
161 (gaim_conversation_get_type(c) == GAIM_CONV_CHAT && |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
162 g_list_find(gaim_get_chats(), c)))) |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
163 filename = NULL; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
164 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
165 gtk_widget_destroy(wid); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
166 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
167 if (filename == NULL) |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
168 return; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
169 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
170 if ((fp = fopen(filename, "w+")) == NULL) |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
171 return; |
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 fprintf(fp, "%s", c->history->str); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
174 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
175 fclose(fp); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
176 } |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
177 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
178 static void |
6038 | 179 do_check_save_convo(GObject *obj, GtkWidget *wid) |
180 { | |
181 const char *filename = gtk_file_selection_get_filename(GTK_FILE_SELECTION(wid)); | |
182 | |
183 if (gaim_gtk_check_if_dir(filename, GTK_FILE_SELECTION(wid))) | |
184 return; | |
185 | |
186 if(g_file_test(filename, G_FILE_TEST_EXISTS)){ | |
187 gaim_request_yes_no(NULL, NULL, _("That file already exists"), | |
188 _("Would you like to overwrite it?"), 1, wid, | |
189 G_CALLBACK(do_save_convo), NULL); | |
190 } | |
191 else | |
192 do_save_convo(wid); | |
193 } | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6460
diff
changeset
|
194 |
6038 | 195 static void |
7927 | 196 do_insert_image_cb(GtkWidget *widget, int resp, gpointer data) |
4359 | 197 { |
7927 | 198 GaimConversation *conv = data; |
199 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); | |
200 GaimConvIm *im = GAIM_CONV_IM(conv); | |
6982 | 201 char *name, *filename; |
7927 | 202 char *buf, *filedata; |
6982 | 203 size_t size; |
7927 | 204 GError *error = NULL; |
4359 | 205 int id; |
206 | |
7927 | 207 if (resp != GTK_RESPONSE_OK) { |
208 set_toggle(gtkconv->toolbar.image, FALSE); | |
209 return; | |
210 } | |
211 | |
212 name = g_strdup(gtk_file_selection_get_filename(GTK_FILE_SELECTION(widget))); | |
6982 | 213 |
214 if (!name) { | |
7927 | 215 set_toggle(gtkconv->toolbar.image, FALSE); |
6982 | 216 return; |
217 } | |
218 | |
7927 | 219 if (gaim_gtk_check_if_dir(name, GTK_FILE_SELECTION(widget))) { |
6982 | 220 g_free(name); |
7927 | 221 set_toggle(gtkconv->toolbar.image, FALSE); |
4359 | 222 return; |
6982 | 223 } |
224 | |
7927 | 225 set_toggle(gtkconv->toolbar.image, FALSE); |
226 | |
227 if (!g_file_get_contents(name, &filedata, &size, &error)) { | |
6982 | 228 gaim_notify_error(NULL, NULL, error->message, NULL); |
229 | |
230 g_error_free(error); | |
231 g_free(name); | |
232 | |
4359 | 233 return; |
234 } | |
235 | |
236 filename = name; | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
237 while (strchr(filename, '/')) |
4359 | 238 filename = strchr(filename, '/') + 1; |
239 | |
7927 | 240 id = gaim_imgstore_add(filedata, size, filename); |
241 g_free(filedata); | |
6982 | 242 |
243 if (!id) { | |
244 buf = g_strdup_printf(_("Failed to store image: %s\n"), name); | |
245 gaim_notify_error(NULL, NULL, buf, NULL); | |
246 | |
247 g_free(buf); | |
248 g_free(name); | |
249 | |
250 return; | |
251 } | |
252 | |
253 im->images = g_slist_append(im->images, GINT_TO_POINTER(id)); | |
254 | |
255 buf = g_strdup_printf("<IMG ID=\"%d\" SRC=\"file://%s\">", id, filename); | |
256 gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(gtkconv->entry_buffer), buf, -1); | |
4359 | 257 g_free(buf); |
5046 | 258 |
6982 | 259 g_free(name); |
4359 | 260 } |
261 | |
262 static gint | |
263 close_win_cb(GtkWidget *w, GdkEventAny *e, gpointer d) | |
264 { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
265 GaimConvWindow *win = (GaimConvWindow *)d; |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
266 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
267 gaim_conv_window_destroy(win); |
4361
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
268 |
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
269 return TRUE; |
4359 | 270 } |
271 | |
272 static gint | |
273 close_conv_cb(GtkWidget *w, gpointer d) | |
274 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
275 GaimConversation *conv = (GaimConversation *)d; |
4359 | 276 |
277 gaim_conversation_destroy(conv); | |
4361
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
278 |
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
279 return TRUE; |
4359 | 280 } |
281 | |
7446
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
282 /* Courtesy of Galeon! */ |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
283 static void |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
284 tab_close_button_state_changed_cb(GtkWidget *widget, GtkStateType prev_state) |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
285 { |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
286 if (GTK_WIDGET_STATE(widget) == GTK_STATE_ACTIVE) |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
287 gtk_widget_set_state(widget, GTK_STATE_NORMAL); |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
288 } |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
289 |
4359 | 290 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
291 insert_image_cb(GtkWidget *save, GaimConversation *conv) |
4359 | 292 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
293 GaimGtkConversation *gtkconv; |
4359 | 294 char buf[BUF_LONG]; |
295 GtkWidget *window; | |
296 | |
297 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
298 | |
5046 | 299 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.image))) { |
7853 | 300 window = gtk_file_selection_new(_("Insert Image")); |
5046 | 301 g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S, gaim_home_dir()); |
302 gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf); | |
303 | |
7927 | 304 gtk_dialog_set_default_response(GTK_DIALOG(window), GTK_RESPONSE_OK); |
305 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(window)), | |
306 "response", G_CALLBACK(do_insert_image_cb), conv); | |
5046 | 307 |
308 gtk_widget_show(window); | |
5106 | 309 gtkconv->dialogs.image = window; |
5046 | 310 } else { |
7927 | 311 gtk_widget_destroy(gtkconv->dialogs.image); |
5106 | 312 gtkconv->dialogs.image = NULL; |
5046 | 313 } |
4359 | 314 } |
315 | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5402
diff
changeset
|
316 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
317 insert_link_cb(GtkWidget *w, 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(gtkconv->toolbar.link))) | |
7927 | 324 dialog_link_show(conv); |
4359 | 325 else |
7927 | 326 dialog_link_destroy(conv); |
4359 | 327 |
328 gtk_widget_grab_focus(gtkconv->entry); | |
329 } | |
330 | |
331 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
332 insert_smiley_cb(GtkWidget *smiley, GaimConversation *conv) |
4359 | 333 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
334 GaimGtkConversation *gtkconv; |
4359 | 335 |
336 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
337 | |
338 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(smiley))) | |
339 show_smiley_dialog(conv, smiley); | |
340 else if (gtkconv->dialogs.smiley) | |
341 close_smiley_dialog(smiley, conv); | |
342 | |
343 gtk_widget_grab_focus(gtkconv->entry); | |
344 } | |
345 | |
346 static gboolean | |
347 entry_key_pressed_cb_1(GtkTextBuffer *buffer) | |
348 { | |
349 check_everything(buffer); | |
350 | |
351 return FALSE; | |
352 } | |
353 | |
7766 | 354 static void default_formatize(GaimConversation *conv) { |
355 GaimGtkConversation *c = GAIM_GTK_CONVERSATION(conv); | |
356 GaimConnection *gc = gaim_conversation_get_gc(conv); | |
357 | |
358 if (gc && gc->flags & GAIM_CONNECTION_HTML) { | |
359 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold")) { | |
360 gtk_imhtml_toggle_bold(GTK_IMHTML(c->entry)); | |
361 } | |
362 | |
363 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic")) { | |
364 gtk_imhtml_toggle_italic(GTK_IMHTML(c->entry)); | |
365 } | |
366 | |
367 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline")) { | |
368 gtk_imhtml_toggle_underline(GTK_IMHTML(c->entry)); | |
369 } | |
370 | |
371 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_strikethrough")) { | |
372 /* Tell me noone uses <s> by default ... maybe I won't do | |
373 _toggle_strikethrough and not let them */ | |
374 /* g_snprintf(buf2, limit, "<STRIKE>%s</STRIKE>", buf); | |
375 strcpy(buf, buf2); */ | |
376 } | |
377 | |
378 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_font") || c->has_font) { | |
379 gtk_imhtml_toggle_fontface(GTK_IMHTML(c->entry), c->fontface); | |
380 } | |
381 | |
382 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_size")) { | |
7778 | 383 gtk_imhtml_font_set_size(GTK_IMHTML(c->entry), gaim_prefs_get_int("/gaim/gtk/conversations/font_size")); |
7766 | 384 } |
385 | |
386 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_fgcolor")) { | |
387 char *color = g_strdup_printf("#%02x%02x%02x", | |
388 c->fg_color.red / 256, | |
389 c->fg_color.green / 256, | |
390 c->fg_color.blue / 256); | |
391 gtk_imhtml_toggle_forecolor(GTK_IMHTML(c->entry), color); | |
392 g_free(color); | |
393 } | |
394 | |
395 if (!(gc->flags & GAIM_CONNECTION_NO_BGCOLOR) && gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_bgcolor")) { | |
396 char *color = g_strdup_printf("#%02x%02x%02x", | |
397 c->bg_color.red / 256, | |
398 c->bg_color.green / 256, | |
399 c->bg_color.blue / 256); | |
400 gtk_imhtml_toggle_backcolor(GTK_IMHTML(c->entry), color); | |
401 g_free(color); | |
402 } | |
403 } | |
404 } | |
405 | |
4359 | 406 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
407 send_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 408 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
409 GaimGtkConversation *gtkconv; |
7946 | 410 char *buf; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
411 GaimConnection *gc = gaim_conversation_get_gc(conv); |
4359 | 412 |
413 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7715 | 414 |
415 if (gc && gc->flags & GAIM_CONNECTION_HTML) | |
7946 | 416 buf = gtk_imhtml_get_markup(GTK_IMHTML(gtkconv->entry)); |
7715 | 417 else |
7946 | 418 buf = gtk_imhtml_get_text(GTK_IMHTML(gtkconv->entry)); |
7695 | 419 |
420 /* set_toggle(gtkconv->toolbar.bold, FALSE); | |
4685 | 421 set_toggle(gtkconv->toolbar.italic, FALSE); |
422 set_toggle(gtkconv->toolbar.underline, FALSE); | |
5049 | 423 set_toggle(gtkconv->toolbar.larger_size, FALSE); |
4685 | 424 set_toggle(gtkconv->toolbar.normal_size, FALSE); |
5049 | 425 set_toggle(gtkconv->toolbar.smaller_size,FALSE); |
4685 | 426 set_toggle(gtkconv->toolbar.font, FALSE); |
427 set_toggle(gtkconv->toolbar.fgcolor, FALSE); | |
428 set_toggle(gtkconv->toolbar.bgcolor, FALSE); | |
429 set_toggle(gtkconv->toolbar.link, FALSE); | |
7695 | 430 */ |
4359 | 431 gtk_widget_grab_focus(gtkconv->entry); |
432 | |
433 if (strlen(buf) == 0) { | |
434 g_free(buf); | |
435 | |
436 return; | |
437 } | |
438 | |
439 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
440 gaim_conv_im_send(GAIM_CONV_IM(conv), buf); |
7879 | 441 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
442 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), buf); |
4359 | 443 |
5629 | 444 if (gaim_prefs_get_bool("/gaim/gtk/conversations/im/hide_on_send")) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
445 gaim_conv_window_hide(gaim_conversation_get_window(conv)); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
446 |
4359 | 447 g_free(buf); |
448 | |
7695 | 449 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); |
7766 | 450 default_formatize(conv); |
4359 | 451 } |
452 | |
453 static void | |
7928 | 454 add_remove_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 455 { |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
456 GaimAccount *account; |
4359 | 457 const char *name; |
458 | |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
459 account = gaim_conversation_get_account(conv); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
460 name = gaim_conversation_get_name(conv); |
7879 | 461 |
462 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
7859 | 463 GaimBuddy *b; |
464 | |
465 b = gaim_find_buddy(account, name); | |
466 if (b != NULL) | |
467 show_confirm_del(b); | |
468 else if (account != NULL && gaim_account_is_connected(account)) | |
469 gaim_blist_request_add_buddy(account, (char *)name, NULL, NULL); | |
7879 | 470 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
7859 | 471 GaimChat *c; |
472 | |
473 c = gaim_blist_find_chat(account, name); | |
474 if (c != NULL) | |
475 show_confirm_del_blist_chat(c); | |
476 else if (account != NULL && gaim_account_is_connected(account)) | |
477 gaim_blist_request_add_chat(account, NULL, NULL); | |
478 } | |
4359 | 479 |
480 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
481 } | |
482 | |
483 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
484 info_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 485 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
486 GaimGtkConversation *gtkconv; |
4359 | 487 |
488 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
489 | |
7879 | 490 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
491 serv_get_info(gaim_conversation_get_gc(conv), | |
492 gaim_conversation_get_name(conv)); | |
493 | |
494 gtk_widget_grab_focus(gtkconv->entry); | |
495 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
496 /* Get info of the person currently selected in the GtkTreeView */ | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
497 GaimGtkChatPane *gtkchat; |
4359 | 498 GtkTreeIter iter; |
499 GtkTreeModel *model; | |
500 GtkTreeSelection *sel; | |
501 const char *name; | |
502 | |
503 gtkchat = gtkconv->u.chat; | |
504 | |
505 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | |
506 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); | |
507 | |
508 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) | |
509 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &name, -1); | |
510 else | |
511 return; | |
512 | |
7879 | 513 serv_get_info(gaim_conversation_get_gc(conv), name); |
4359 | 514 } |
515 } | |
516 | |
517 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
518 warn_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 519 { |
520 show_warn_dialog(gaim_conversation_get_gc(conv), | |
7879 | 521 gaim_conversation_get_name(conv)); |
4359 | 522 |
523 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
524 } | |
525 | |
526 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
527 block_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 528 { |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
529 GaimAccount *account; |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
530 |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
531 account = gaim_conversation_get_account(conv); |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
532 |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
533 if (account != NULL && gaim_account_is_connected(account)) |
6399
d726a36628e8
[gaim-migrate @ 6904]
Christian Hammond <chipx86@chipx86.com>
parents:
6398
diff
changeset
|
534 gaim_gtk_request_add_block(account, gaim_conversation_get_name(conv)); |
4359 | 535 |
536 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
537 } | |
538 | |
539 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
540 do_invite(GtkWidget *w, int resp, InviteBuddyInfo *info) |
4359 | 541 { |
542 const char *buddy, *message; | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
543 GaimGtkConversation *gtkconv; |
4359 | 544 |
545 gtkconv = GAIM_GTK_CONVERSATION(info->conv); | |
546 | |
547 if (resp == GTK_RESPONSE_OK) { | |
548 buddy = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(info->entry)->entry)); | |
549 message = gtk_entry_get_text(GTK_ENTRY(info->message)); | |
550 | |
4793 | 551 if (!g_ascii_strcasecmp(buddy, "")) { |
4359 | 552 g_free(info); |
553 | |
554 return; | |
555 } | |
556 | |
557 serv_chat_invite(gaim_conversation_get_gc(info->conv), | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
558 gaim_conv_chat_get_id(GAIM_CONV_CHAT(info->conv)), |
4359 | 559 message, buddy); |
560 } | |
561 | |
562 gtk_widget_destroy(invite_dialog); | |
563 invite_dialog = NULL; | |
564 | |
565 g_free(info); | |
566 } | |
567 | |
568 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
569 invite_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 570 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
571 InviteBuddyInfo *info = NULL; |
4359 | 572 |
573 if (invite_dialog == NULL) { | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
574 GaimConnection *gc; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
575 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
576 GaimGtkWindow *gtkwin; |
4359 | 577 GtkWidget *label; |
578 GtkWidget *vbox, *hbox; | |
579 GtkWidget *table; | |
580 GtkWidget *img; | |
581 | |
5024 | 582 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG); |
4359 | 583 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
584 info = g_new0(InviteBuddyInfo, 1); |
4359 | 585 info->conv = conv; |
586 | |
587 gc = gaim_conversation_get_gc(conv); | |
588 win = gaim_conversation_get_window(conv); | |
589 gtkwin = GAIM_GTK_WINDOW(win); | |
590 | |
591 /* Create the new dialog. */ | |
592 invite_dialog = gtk_dialog_new_with_buttons( | |
7859 | 593 _("Invite Buddy Into Chat Room"), |
7879 | 594 GTK_WINDOW(gtkwin->window), 0, |
595 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, | |
4359 | 596 GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); |
597 | |
598 gtk_dialog_set_default_response(GTK_DIALOG(invite_dialog), | |
599 GTK_RESPONSE_OK); | |
600 gtk_container_set_border_width(GTK_CONTAINER(invite_dialog), 6); | |
601 gtk_window_set_resizable(GTK_WINDOW(invite_dialog), FALSE); | |
602 gtk_dialog_set_has_separator(GTK_DIALOG(invite_dialog), FALSE); | |
603 | |
604 /* Setup the outside spacing. */ | |
605 vbox = GTK_DIALOG(invite_dialog)->vbox; | |
606 | |
607 gtk_box_set_spacing(GTK_BOX(vbox), 12); | |
608 gtk_container_set_border_width(GTK_CONTAINER(vbox), 6); | |
609 | |
610 /* Setup the inner hbox and put the dialog's icon in it. */ | |
611 hbox = gtk_hbox_new(FALSE, 12); | |
612 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
613 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
614 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
615 | |
616 /* Setup the right vbox. */ | |
617 vbox = gtk_vbox_new(FALSE, 0); | |
618 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
619 | |
620 /* Put our happy label in it. */ | |
621 label = gtk_label_new(_("Please enter the name of the user you wish " | |
622 "to invite, along with an optional invite " | |
623 "message.")); | |
624 gtk_widget_set_size_request(label, 350, -1); | |
625 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
626 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
627 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
628 | |
629 /* hbox for the table, and to give it some spacing on the left. */ | |
630 hbox = gtk_hbox_new(FALSE, 6); | |
631 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
632 | |
633 /* Setup the table we're going to use to lay stuff out. */ | |
634 table = gtk_table_new(2, 2, FALSE); | |
635 gtk_table_set_row_spacings(GTK_TABLE(table), 6); | |
636 gtk_table_set_col_spacings(GTK_TABLE(table), 6); | |
637 gtk_container_set_border_width(GTK_CONTAINER(table), 12); | |
638 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); | |
639 | |
640 /* Now the Buddy label */ | |
641 label = gtk_label_new(NULL); | |
642 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Buddy:")); | |
643 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
644 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); | |
645 | |
646 /* Now the Buddy drop-down entry field. */ | |
647 info->entry = gtk_combo_new(); | |
648 gtk_combo_set_case_sensitive(GTK_COMBO(info->entry), FALSE); | |
649 gtk_entry_set_activates_default( | |
650 GTK_ENTRY(GTK_COMBO(info->entry)->entry), TRUE); | |
651 | |
652 gtk_table_attach_defaults(GTK_TABLE(table), info->entry, 1, 2, 0, 1); | |
653 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->entry); | |
654 | |
655 /* Fill in the names. */ | |
656 gtk_combo_set_popdown_strings(GTK_COMBO(info->entry), | |
657 generate_invite_user_names(gc)); | |
658 | |
659 | |
660 /* Now the label for "Message" */ | |
661 label = gtk_label_new(NULL); | |
662 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Message:")); | |
663 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
664 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); | |
665 | |
666 | |
667 /* And finally, the Message entry field. */ | |
668 info->message = gtk_entry_new(); | |
669 gtk_entry_set_activates_default(GTK_ENTRY(info->message), TRUE); | |
670 | |
671 gtk_table_attach_defaults(GTK_TABLE(table), info->message, 1, 2, 1, 2); | |
672 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->message); | |
673 | |
674 /* Connect the signals. */ | |
675 g_signal_connect(G_OBJECT(invite_dialog), "response", | |
676 G_CALLBACK(do_invite), info); | |
677 } | |
678 | |
679 gtk_widget_show_all(invite_dialog); | |
680 | |
681 if (info != NULL) | |
682 gtk_widget_grab_focus(GTK_COMBO(info->entry)->entry); | |
683 } | |
684 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
685 static void |
7748 | 686 menu_new_conv_cb(gpointer data, guint action, GtkWidget *widget) |
687 { | |
688 show_im_dialog(); | |
689 } | |
690 | |
691 static void | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
692 menu_save_as_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
693 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
694 GaimConvWindow *win = (GaimConvWindow *)data; |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
695 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
696 save_convo(NULL, gaim_conv_window_get_active_conversation(win)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
697 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
698 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
699 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
700 menu_view_log_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
701 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
702 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
703 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
704 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
705 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
706 |
7431 | 707 gaim_gtk_log_show((char *)gaim_conversation_get_name(conv), gaim_conversation_get_account(conv)); |
5908
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 |
7295 | 710 struct _search { |
711 GaimGtkConversation *gtkconv; | |
712 GtkWidget *entry; | |
713 }; | |
714 | |
7929 | 715 static void do_search_cb(GtkWidget *widget, gint resp, struct _search *s) |
7295 | 716 { |
7929 | 717 switch (resp) { |
718 case GTK_RESPONSE_OK: | |
719 gtk_imhtml_search_find(GTK_IMHTML(s->gtkconv->imhtml), gtk_entry_get_text(GTK_ENTRY(s->entry))); | |
720 break; | |
721 | |
722 case GTK_RESPONSE_DELETE_EVENT: | |
723 case GTK_RESPONSE_CLOSE: | |
724 gtk_imhtml_search_clear(GTK_IMHTML(s->gtkconv->imhtml)); | |
725 gtk_widget_destroy(s->gtkconv->dialogs.search); | |
726 s->gtkconv->dialogs.search = NULL; | |
727 g_free(s); | |
728 break; | |
729 } | |
7295 | 730 } |
731 | |
732 static void | |
7751 | 733 menu_find_cb(gpointer data, guint action, GtkWidget *widget) |
7295 | 734 { |
735 GaimConvWindow *win = (GaimConvWindow *)data; | |
736 GaimConversation *conv = gaim_conv_window_get_active_conversation(win); | |
737 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); | |
738 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7929 | 739 GtkWidget *hbox; |
7295 | 740 GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG); |
7929 | 741 GtkWidget *label; |
7295 | 742 struct _search *s; |
743 | |
7798 | 744 if (gtkconv->dialogs.search) { |
745 gtk_window_present(GTK_WINDOW(gtkconv->dialogs.search)); | |
7295 | 746 return; |
7798 | 747 } |
7300
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
748 |
7295 | 749 s = g_malloc(sizeof(struct _search)); |
750 s->gtkconv = gtkconv; | |
7929 | 751 |
752 gtkconv->dialogs.search = gtk_dialog_new_with_buttons(_("Find"), | |
753 GTK_WINDOW(gtkwin->window), GTK_DIALOG_DESTROY_WITH_PARENT, | |
754 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, | |
755 GTK_STOCK_FIND, GTK_RESPONSE_OK, NULL); | |
756 gtk_dialog_set_default_response(GTK_DIALOG(gtkconv->dialogs.search), GTK_RESPONSE_OK); | |
757 g_signal_connect(G_OBJECT(gtkconv->dialogs.search), "response", | |
758 G_CALLBACK(do_search_cb), s); | |
759 | |
760 gtk_container_set_border_width(GTK_CONTAINER(gtkconv->dialogs.search), 6); | |
761 gtk_window_set_resizable(GTK_WINDOW(gtkconv->dialogs.search), FALSE); | |
762 gtk_dialog_set_has_separator(GTK_DIALOG(gtkconv->dialogs.search), FALSE); | |
763 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(gtkconv->dialogs.search)->vbox), 12); | |
764 gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(gtkconv->dialogs.search)->vbox), 6); | |
765 | |
766 hbox = gtk_hbox_new(FALSE, 12); | |
767 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(gtkconv->dialogs.search)->vbox), hbox); | |
768 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
769 | |
770 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
771 gtk_dialog_set_response_sensitive(GTK_DIALOG(gtkconv->dialogs.search), GTK_RESPONSE_OK, FALSE); | |
772 | |
773 label = gtk_label_new(NULL); | |
774 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Search for:")); | |
775 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
776 | |
777 s->entry = gtk_entry_new(); | |
778 gtk_entry_set_activates_default(GTK_ENTRY(s->entry), TRUE); | |
779 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(s->entry)); | |
780 g_signal_connect(G_OBJECT(s->entry), "changed", | |
781 G_CALLBACK(gaim_gtk_set_sensitive_if_input), | |
782 gtkconv->dialogs.search); | |
783 gtk_box_pack_start(GTK_BOX(hbox), s->entry, FALSE, FALSE, 0); | |
7300
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
784 |
7295 | 785 gtk_widget_show_all(gtkconv->dialogs.search); |
7929 | 786 gtk_widget_grab_focus(s->entry); |
7295 | 787 } |
788 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
789 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
790 menu_add_pounce_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
791 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
792 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
793 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
794 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
795 conv = gaim_conv_window_get_active_conversation(win); |
5908
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 gaim_gtkpounce_dialog_show(gaim_conversation_get_account(conv), |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
798 gaim_conversation_get_name(conv), NULL); |
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 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
801 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
802 menu_insert_link_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
803 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
804 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
805 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
806 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
807 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
808 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
809 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
810 |
7927 | 811 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.link), |
812 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.link))); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
813 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
814 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
815 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
816 menu_insert_image_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
817 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
818 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
819 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
820 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
821 gtkconv = GAIM_GTK_CONVERSATION(gaim_conv_window_get_active_conversation(win)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
822 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
823 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.image), |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
824 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.image))); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
825 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
826 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
827 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
828 menu_alias_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
829 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
830 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
831 GaimConversation *conv; |
7879 | 832 GaimAccount *account; |
833 const char *name; | |
834 | |
835 conv = gaim_conv_window_get_active_conversation(win); | |
836 account = gaim_conversation_get_account(conv); | |
837 name = gaim_conversation_get_name(conv); | |
838 | |
839 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
840 GaimBuddy *b; | |
841 | |
842 b = gaim_find_buddy(account, name); | |
843 if (b != NULL) | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
844 alias_dialog_bud(b); |
7879 | 845 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
846 GaimChat *c; | |
847 | |
848 c = gaim_blist_find_chat(account, name); | |
849 if (c != NULL) | |
850 alias_dialog_blist_chat(c); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
851 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
852 } |
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 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
855 menu_get_info_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
856 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
857 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
858 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
859 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
860 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
861 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
862 info_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
863 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
864 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
865 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
866 menu_invite_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
867 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
868 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
869 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
870 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
871 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
872 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
873 invite_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
874 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
875 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
876 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
877 menu_warn_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
878 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
879 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
880 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
881 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
882 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
883 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
884 warn_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
885 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
886 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
887 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
888 menu_block_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
889 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
890 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
891 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
892 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
893 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
894 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
895 block_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
896 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
897 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
898 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
899 menu_add_remove_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
900 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
901 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
902 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
903 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
904 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
905 |
7928 | 906 add_remove_cb(NULL, conv); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
907 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
908 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
909 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
910 menu_close_conv_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
911 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
912 GaimConvWindow *win = (GaimConvWindow *)data; |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
913 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
914 close_conv_cb(NULL, gaim_conv_window_get_active_conversation(win)); |
5908
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 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
917 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
918 menu_logging_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
919 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
920 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
921 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
922 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
923 conv = gaim_conv_window_get_active_conversation(win); |
5908
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 if (conv == NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
926 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
927 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
928 gaim_conversation_set_logging(conv, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
929 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
930 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
931 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
932 static void |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
933 menu_toolbar_cb(gpointer data, guint action, GtkWidget *widget) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
934 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
935 GaimConvWindow *win = (GaimConvWindow *)data; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
936 GaimConversation *conv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
937 GaimGtkConversation *gtkconv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
938 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
939 conv = gaim_conv_window_get_active_conversation(win); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
940 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
941 if (conv == NULL) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
942 return; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
943 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
944 gtkconv = GAIM_GTK_CONVERSATION(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
945 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
946 gtkconv->show_formatting_toolbar = |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
947 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
948 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
949 if (gtkconv->show_formatting_toolbar) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
950 gtk_widget_show(gtkconv->toolbar.toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
951 else |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
952 gtk_widget_hide(gtkconv->toolbar.toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
953 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
954 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
955 static void |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
956 menu_sounds_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
957 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
958 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
959 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
960 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
961 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
962 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
963 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
964 if (!conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
965 return; |
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 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
968 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
969 gtkconv->make_sound = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
970 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); |
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 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
973 void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
974 im_cb(GtkWidget *widget, GaimConversation *conv) |
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 GaimConversation *conv2; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
977 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
978 GaimGtkChatPane *gtkchat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
979 GaimAccount *account; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
980 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
981 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
982 GtkTreeSelection *sel; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
983 const char *name; |
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 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
986 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
987 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
988 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
989 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); |
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 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
992 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
|
993 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
994 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
995 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
996 if (*name == '@') name++; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
997 if (*name == '%') name++; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
998 if (*name == '+') name++; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
999 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1000 account = gaim_conversation_get_account(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1001 |
6640
314111e7b601
[gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents:
6629
diff
changeset
|
1002 conv2 = gaim_find_conversation_with_account(name, account); |
314111e7b601
[gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents:
6629
diff
changeset
|
1003 |
314111e7b601
[gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents:
6629
diff
changeset
|
1004 if (conv2 != NULL) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1005 gaim_conv_window_raise(gaim_conversation_get_window(conv2)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1006 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1007 conv2 = gaim_conversation_new(GAIM_CONV_IM, account, name); |
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 void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1011 ignore_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1012 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1013 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1014 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1015 GaimConvChat *chat; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1016 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1017 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1018 GtkTreeSelection *sel; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1019 const char *name; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1020 int pos; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1021 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1022 chat = GAIM_CONV_CHAT(conv); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1023 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1024 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1025 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1026 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1027 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1028 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1029 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1030 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
|
1031 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
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 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1034 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1035 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1036 pos = g_list_index(gaim_conv_chat_get_users(chat), name); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1037 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1038 if (gaim_conv_chat_is_user_ignored(chat, name)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1039 gaim_conv_chat_unignore(chat, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1040 else |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1041 gaim_conv_chat_ignore(chat, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1042 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1043 add_chat_buddy_common(conv, name, pos); |
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 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1046 static void |
7398 | 1047 chat_do_im(GaimConversation *conv, const char *who) |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1048 { |
7398 | 1049 GaimPluginProtocolInfo *prpl_info = NULL; |
1050 char *real_who; | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1051 GaimConversation *conv2; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1052 GaimAccount *account; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1053 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1054 account = gaim_conversation_get_account(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1055 |
7398 | 1056 if(account && account->gc) |
1057 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl); | |
1058 | |
1059 if(prpl_info && prpl_info->get_cb_real_name) | |
1060 real_who = prpl_info->get_cb_real_name(account->gc, | |
1061 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); | |
1062 else | |
1063 real_who = g_strdup(who); | |
1064 | |
1065 if(!real_who) | |
1066 return; | |
1067 | |
1068 conv2 = gaim_find_conversation_with_account(real_who, account); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1069 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1070 if (conv2 != NULL) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1071 gaim_conv_window_show(gaim_conversation_get_window(conv2)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1072 else |
7398 | 1073 conv2 = gaim_conversation_new(GAIM_CONV_IM, account, real_who); |
1074 | |
1075 g_free(real_who); | |
1076 } | |
1077 | |
1078 static void | |
1079 menu_chat_im_cb(GtkWidget *w, GaimConversation *conv) | |
1080 { | |
1081 const char *who = g_object_get_data(G_OBJECT(w), "user_data"); | |
1082 | |
1083 chat_do_im(conv, who); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1084 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1085 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1086 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1087 menu_chat_info_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1088 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1089 GaimPluginProtocolInfo *prpl_info = NULL; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1090 GaimConnection *gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1091 char *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1092 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1093 gc = gaim_conversation_get_gc(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1094 who = g_object_get_data(G_OBJECT(w), "user_data"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1095 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1096 if (gc != NULL) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1097 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1098 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1099 /* |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1100 * If there are special needs for getting info on users in |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1101 * buddy chat "rooms"... |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1102 */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1103 if (prpl_info->get_cb_info != NULL) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1104 prpl_info->get_cb_info(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1105 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1106 prpl_info->get_info(gc, who); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1107 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1108 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1109 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1110 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1111 menu_chat_get_away_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1112 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1113 GaimPluginProtocolInfo *prpl_info = NULL; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1114 GaimConnection *gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1115 char *who; |
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 gc = gaim_conversation_get_gc(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1118 who = g_object_get_data(G_OBJECT(w), "user_data"); |
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 if (gc != NULL) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1121 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1122 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1123 /* |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1124 * 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
|
1125 */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1126 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1127 if (prpl_info->get_cb_away != NULL) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1128 prpl_info->get_cb_away(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); |
5908
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 } |
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 static void |
7928 | 1133 menu_chat_add_remove_cb(GtkWidget *w, GaimConversation *conv) |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1134 { |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1135 GaimAccount *account; |
6695 | 1136 GaimBuddy *b; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1137 char *name; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1138 |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1139 account = gaim_conversation_get_account(conv); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1140 name = g_object_get_data(G_OBJECT(w), "user_data"); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1141 b = gaim_find_buddy(account, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1142 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1143 if (b != NULL) |
5975 | 1144 show_confirm_del(b); |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1145 else if (account != NULL && gaim_account_is_connected(account)) |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1146 gaim_blist_request_add_buddy(account, name, NULL, NULL); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1147 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1148 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1149 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1150 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1151 static gint |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1152 right_click_chat_cb(GtkWidget *widget, GdkEventButton *event, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1153 GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1154 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1155 GaimPluginProtocolInfo *prpl_info = NULL; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1156 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1157 GaimGtkChatPane *gtkchat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1158 GaimConnection *gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1159 GaimAccount *account; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1160 GtkTreePath *path; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1161 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1162 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1163 GtkTreeViewColumn *column; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1164 gchar *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1165 int x, y; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1166 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1167 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1168 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1169 account = gaim_conversation_get_account(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1170 gc = account->gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1171 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1172 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1173 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1174 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
|
1175 event->x, event->y, &path, &column, &x, &y); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1176 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1177 if (path == NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1178 return FALSE; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1179 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1180 if (gc != NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1181 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1182 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1183 gtk_tree_selection_select_path(GTK_TREE_SELECTION( |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1184 gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list))), path); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1185 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1186 gtk_tree_model_get_iter(GTK_TREE_MODEL(model), &iter, path); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1187 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
|
1188 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1189 if (*who == '@') who++; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1190 if (*who == '%') who++; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1191 if (*who == '+') who++; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1192 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1193 if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) { |
7398 | 1194 chat_do_im(conv, who); |
1195 } else if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1196 static GtkWidget *menu = NULL; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1197 GtkWidget *button; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1198 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1199 /* |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1200 * 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
|
1201 * thus freeing-up the memory it occupied. |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1202 */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1203 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1204 if (menu) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1205 gtk_widget_destroy(menu); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1206 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1207 menu = gtk_menu_new(); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1208 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1209 button = gtk_menu_item_new_with_label(_("IM")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1210 g_signal_connect(G_OBJECT(button), "activate", |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1211 G_CALLBACK(menu_chat_im_cb), conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1212 g_object_set_data(G_OBJECT(button), "user_data", who); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1213 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1214 gtk_widget_show(button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1215 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1216 if (gaim_conv_chat_is_user_ignored(GAIM_CONV_CHAT(conv), who)) |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1217 button = gtk_menu_item_new_with_label(_("Un-Ignore")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1218 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1219 button = gtk_menu_item_new_with_label(_("Ignore")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1220 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1221 g_signal_connect(G_OBJECT(button), "activate", |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1222 G_CALLBACK(ignore_cb), conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1223 g_object_set_data(G_OBJECT(button), "user_data", who); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1224 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1225 gtk_widget_show(button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1226 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1227 if (gc && prpl_info->get_info) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1228 button = gtk_menu_item_new_with_label(_("Info")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1229 g_signal_connect(G_OBJECT(button), "activate", |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1230 G_CALLBACK(menu_chat_info_cb), conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1231 g_object_set_data(G_OBJECT(button), "user_data", who); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1232 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1233 gtk_widget_show(button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1234 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1235 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1236 if (gc && prpl_info->get_cb_away) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1237 button = gtk_menu_item_new_with_label(_("Get Away Msg")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1238 g_signal_connect(G_OBJECT(button), "activate", |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1239 G_CALLBACK(menu_chat_get_away_cb), conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1240 g_object_set_data(G_OBJECT(button), "user_data", who); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1241 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1242 gtk_widget_show(button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1243 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1244 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1245 /* Added by Jonas <jonas@birme.se> */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1246 if (gc) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1247 if (gaim_find_buddy(gc->account, who)) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1248 button = gtk_menu_item_new_with_label(_("Remove")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1249 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1250 button = gtk_menu_item_new_with_label(_("Add")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1251 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1252 g_signal_connect(G_OBJECT(button), "activate", |
7928 | 1253 G_CALLBACK(menu_chat_add_remove_cb), conv); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1254 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1255 g_object_set_data(G_OBJECT(button), "user_data", who); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1256 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1257 gtk_widget_show(button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1258 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1259 /* End Jonas */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1260 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1261 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1262 event->button, event->time); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1263 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1264 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1265 return TRUE; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1266 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1267 |
4359 | 1268 static gboolean |
1269 entry_key_pressed_cb_2(GtkWidget *entry, GdkEventKey *event, gpointer data) | |
1270 { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1271 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1272 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1273 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1274 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1275 |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1276 conv = (GaimConversation *)data; |
4359 | 1277 gtkconv = GAIM_GTK_CONVERSATION(conv); |
1278 win = gaim_conversation_get_window(conv); | |
4362 | 1279 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 1280 |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
1281 if (event->keyval == GDK_Page_Up) { |
4359 | 1282 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); |
1283 | |
1284 if (!(event->state & GDK_CONTROL_MASK)) | |
1285 gtk_imhtml_page_up(GTK_IMHTML(gtkconv->imhtml)); | |
1286 } | |
1287 else if (event->keyval == GDK_Page_Down) { | |
1288 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1289 | |
1290 if (!(event->state & GDK_CONTROL_MASK)) | |
1291 gtk_imhtml_page_down(GTK_IMHTML(gtkconv->imhtml)); | |
1292 } | |
6033 | 1293 else if (event->keyval == GDK_F2) { |
1294 | |
1295 gaim_prefs_set_bool("/gaim/gtk/conversations/show_timestamps", | |
1296 !gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); | |
4359 | 1297 } |
1298 else if (event->keyval == GDK_Return || event->keyval == GDK_KP_Enter) { | |
1299 if ((event->state & GDK_CONTROL_MASK) && | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1300 gaim_prefs_get_bool("/gaim/gtk/conversations/ctrl_enter_sends")) { |
4359 | 1301 |
1302 send_cb(NULL, conv); | |
1303 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1304 | |
1305 return TRUE; | |
1306 } | |
1307 else if (!(event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK)) && | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1308 gaim_prefs_get_bool("/gaim/gtk/conversations/enter_sends")) { |
4359 | 1309 |
1310 send_cb(NULL, conv); | |
1311 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1312 | |
1313 return TRUE; | |
1314 } | |
1315 | |
1316 return FALSE; | |
1317 } | |
6014 | 1318 else if ((event->state & GDK_CONTROL_MASK) && (event->keyval == 'm' || |
1319 event->keyval == 'M')) { | |
4359 | 1320 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); |
1321 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, "\n", 1); | |
1322 } | |
1323 else if (event->state & GDK_CONTROL_MASK) { | |
1324 switch (event->keyval) { | |
1325 case GDK_Up: | |
1326 if (!conv->send_history) | |
1327 break; | |
1328 | |
1329 if (!conv->send_history->prev) { | |
1330 GtkTextIter start, end; | |
1331 | |
1332 if (conv->send_history->data) | |
1333 g_free(conv->send_history->data); | |
1334 | |
1335 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, | |
1336 &start); | |
1337 gtk_text_buffer_get_end_iter(gtkconv->entry_buffer, &end); | |
1338 | |
1339 conv->send_history->data = | |
1340 gtk_text_buffer_get_text(gtkconv->entry_buffer, | |
1341 &start, &end, FALSE); | |
1342 } | |
1343 | |
1344 if (conv->send_history->next && | |
1345 conv->send_history->next->data) { | |
1346 | |
1347 conv->send_history = conv->send_history->next; | |
7801 | 1348 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); |
1349 gtk_imhtml_append_text_with_images(GTK_IMHTML(gtkconv->entry), conv->send_history->data, 0, NULL); | |
4359 | 1350 } |
1351 | |
1352 break; | |
1353 | |
1354 case GDK_Down: | |
1355 if (!conv->send_history) | |
1356 break; | |
1357 | |
1358 if (conv->send_history->prev) { | |
1359 conv->send_history = conv->send_history->prev; | |
1360 | |
7801 | 1361 if (conv->send_history->data) { |
1362 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); | |
1363 gtk_imhtml_append_text_with_images(GTK_IMHTML(gtkconv->entry), conv->send_history->data, 0, NULL); | |
1364 } | |
4359 | 1365 } |
1366 | |
1367 break; | |
1368 } | |
1369 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1370 if (gaim_prefs_get_bool("/gaim/gtk/conversations/html_shortcuts")) { |
4359 | 1371 switch (event->keyval) { |
1372 case 'i': | |
1373 case 'I': | |
4685 | 1374 set_toggle(gtkconv->toolbar.italic, |
4359 | 1375 !gtk_toggle_button_get_active( |
1376 GTK_TOGGLE_BUTTON(gtkconv->toolbar.italic))); | |
1377 | |
1378 g_signal_stop_emission_by_name(G_OBJECT(entry), | |
1379 "key_press_event"); | |
1380 break; | |
1381 | |
1382 case 'u': /* ctrl-u is GDK_Clear, which clears the line. */ | |
1383 case 'U': | |
4685 | 1384 set_toggle(gtkconv->toolbar.underline, |
4359 | 1385 !gtk_toggle_button_get_active( |
1386 GTK_TOGGLE_BUTTON(gtkconv->toolbar.underline))); | |
1387 | |
1388 g_signal_stop_emission_by_name(G_OBJECT(entry), | |
1389 "key_press_event"); | |
1390 break; | |
1391 | |
1392 case 'b': /* ctrl-b is GDK_Left, which moves backwards. */ | |
1393 case 'B': | |
4685 | 1394 set_toggle(gtkconv->toolbar.bold, |
4359 | 1395 !gtk_toggle_button_get_active( |
1396 GTK_TOGGLE_BUTTON(gtkconv->toolbar.bold))); | |
1397 | |
1398 g_signal_stop_emission_by_name(G_OBJECT(entry), | |
1399 "key_press_event"); | |
1400 break; | |
6014 | 1401 |
4359 | 1402 case '-': |
6015 | 1403 set_toggle(gtkconv->toolbar.smaller_size, |
1404 !gtk_toggle_button_get_active( | |
1405 GTK_TOGGLE_BUTTON(gtkconv->toolbar.smaller_size))); | |
6014 | 1406 |
4359 | 1407 g_signal_stop_emission_by_name(G_OBJECT(entry), |
1408 "key_press_event"); | |
1409 break; | |
1410 | |
1411 case '=': | |
1412 case '+': | |
6015 | 1413 set_toggle(gtkconv->toolbar.larger_size, |
1414 !gtk_toggle_button_get_active( | |
1415 GTK_TOGGLE_BUTTON(gtkconv->toolbar.larger_size))); | |
4359 | 1416 |
1417 g_signal_stop_emission_by_name(G_OBJECT(entry), | |
1418 "key_press_event"); | |
1419 break; | |
1420 | |
1421 case '0': | |
7740 | 1422 /*set_toggle(gtkconv->toolbar.normal_size, |
4685 | 1423 !gtk_toggle_button_get_active( |
1424 GTK_TOGGLE_BUTTON(gtkconv->toolbar.normal_size))); | |
4359 | 1425 |
1426 g_signal_stop_emission_by_name(G_OBJECT(entry), | |
7740 | 1427 "key_press_event"); */ |
4359 | 1428 break; |
1429 | |
1430 case 'f': | |
1431 case 'F': | |
4685 | 1432 set_toggle(gtkconv->toolbar.font, |
4359 | 1433 !gtk_toggle_button_get_active( |
4685 | 1434 GTK_TOGGLE_BUTTON(gtkconv->toolbar.font))); |
4359 | 1435 |
1436 g_signal_stop_emission_by_name(G_OBJECT(entry), | |
1437 "key_press_event"); | |
1438 break; | |
1439 } | |
1440 } | |
1441 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1442 if (gaim_prefs_get_bool("/gaim/gtk/conversations/smiley_shortcuts")) { |
4359 | 1443 char buf[7]; |
1444 | |
1445 *buf = '\0'; | |
1446 | |
1447 switch (event->keyval) { | |
1448 case '1': strcpy(buf, ":-)"); break; | |
1449 case '2': strcpy(buf, ":-("); break; | |
1450 case '3': strcpy(buf, ";-)"); break; | |
1451 case '4': strcpy(buf, ":-P"); break; | |
1452 case '5': strcpy(buf, "=-O"); break; | |
1453 case '6': strcpy(buf, ":-*"); break; | |
1454 case '7': strcpy(buf, ">:o"); break; | |
1455 case '8': strcpy(buf, "8-)"); break; | |
1456 case '!': strcpy(buf, ":-$"); break; | |
1457 case '@': strcpy(buf, ":-!"); break; | |
1458 case '#': strcpy(buf, ":-["); break; | |
1459 case '$': strcpy(buf, "O:-)"); break; | |
1460 case '%': strcpy(buf, ":-/"); break; | |
1461 case '^': strcpy(buf, ":'("); break; | |
1462 case '&': strcpy(buf, ":-X"); break; | |
1463 case '*': strcpy(buf, ":-D"); break; | |
1464 default: break; | |
1465 } | |
1466 | |
1467 if (*buf) { | |
1468 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, | |
1469 buf, -1); | |
1470 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1471 } | |
1472 } | |
1473 | |
1474 if (event->keyval == 'l') { | |
1475 gtk_imhtml_clear(GTK_IMHTML(gtkconv->imhtml)); | |
1476 g_string_free(conv->history, TRUE); | |
1477 conv->history = g_string_new(""); | |
1478 } | |
1479 else if (event->keyval == 'z') { | |
1480 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
5133 | 1481 |
1482 gtk_window_iconify(GTK_WINDOW(gtkwin->window)); | |
4359 | 1483 } |
1484 else if (event->keyval == '[') { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1485 gaim_conv_window_switch_conversation(win, |
4359 | 1486 gaim_conversation_get_index(conv) - 1); |
1487 | |
1488 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1489 } | |
1490 else if (event->keyval == ']') { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1491 gaim_conv_window_switch_conversation(win, |
4359 | 1492 gaim_conversation_get_index(conv) + 1); |
1493 | |
1494 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1495 } | |
1496 else if (event->keyval == GDK_Tab) { | |
1497 move_next_tab(conv); | |
1498 | |
1499 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1500 | |
1501 return TRUE; | |
1502 } | |
1503 } | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1504 else if (event->keyval == GDK_Tab && |
4359 | 1505 gaim_conversation_get_type(conv) == GAIM_CONV_CHAT && |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1506 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/tab_completion")) { |
4359 | 1507 |
1508 tab_complete(conv); | |
1509 | |
1510 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1511 | |
1512 return TRUE; | |
1513 } | |
1514 else if ((event->state & GDK_MOD1_MASK) && | |
1515 event->keyval > '0' && event->keyval <= '9') { | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1516 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1517 gaim_conv_window_switch_conversation(win, event->keyval - '1'); |
4359 | 1518 |
1519 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1520 } | |
1521 | |
1522 return FALSE; | |
1523 } | |
1524 | |
1525 /* | |
1526 * NOTE: | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1527 * This guy just kills a single right click from being propagated any |
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1528 * further. I have no idea *why* we need this, but we do ... It |
4359 | 1529 * prevents right clicks on the GtkTextView in a convo dialog from |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1530 * going all the way down to the notebook. I suspect a bug in |
4359 | 1531 * GtkTextView, but I'm not ready to point any fingers yet. |
1532 */ | |
1533 static gboolean | |
1534 entry_stop_rclick_cb(GtkWidget *widget, GdkEventButton *event, gpointer data) | |
1535 { | |
1536 if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { | |
1537 /* Right single click */ | |
1538 g_signal_stop_emission_by_name(G_OBJECT(widget), "button_press_event"); | |
1539 | |
1540 return TRUE; | |
1541 } | |
1542 | |
1543 return FALSE; | |
1544 } | |
1545 | |
6057 | 1546 static gboolean |
1547 refocus_entry_cb(GtkWidget *widget, GdkEventButton *event, gpointer data) | |
1548 { | |
1549 GaimGtkConversation *gtkconv = data; | |
1550 | |
1551 gtk_widget_grab_focus(gtkconv->entry); | |
1552 | |
1553 return FALSE; | |
1554 } | |
1555 | |
4359 | 1556 static void |
4673 | 1557 menu_conv_sel_send_cb(GObject *m, gpointer data) |
4359 | 1558 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1559 GaimConvWindow *win = g_object_get_data(m, "user_data"); |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
1560 GaimAccount *account = g_object_get_data(m, "gaim_account"); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1561 GaimConversation *conv; |
4359 | 1562 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1563 conv = gaim_conv_window_get_active_conversation(win); |
4359 | 1564 |
4491 | 1565 gaim_conversation_set_account(conv, account); |
4359 | 1566 } |
1567 | |
1568 static void | |
1569 insert_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *position, | |
1570 gchar *new_text, gint new_text_length, gpointer user_data) | |
1571 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1572 GaimConversation *conv = (GaimConversation *)user_data; |
4359 | 1573 |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1574 g_return_if_fail(conv != NULL); |
4359 | 1575 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1576 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) |
4359 | 1577 return; |
1578 | |
1579 got_typing_keypress(conv, (gtk_text_iter_is_start(position) && | |
1580 gtk_text_iter_is_end(position))); | |
1581 } | |
1582 | |
1583 static void | |
1584 delete_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *start_pos, | |
1585 GtkTextIter *end_pos, gpointer user_data) | |
1586 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1587 GaimConversation *conv = (GaimConversation *)user_data; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1588 GaimConvIm *im; |
4359 | 1589 |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1590 g_return_if_fail(conv != NULL); |
4359 | 1591 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1592 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) |
4359 | 1593 return; |
1594 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1595 im = GAIM_CONV_IM(conv); |
4359 | 1596 |
1597 if (gtk_text_iter_is_start(start_pos) && gtk_text_iter_is_end(end_pos)) { | |
1598 | |
1599 /* We deleted all the text, so turn off typing. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1600 if (gaim_conv_im_get_type_again_timeout(im)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1601 gaim_conv_im_stop_type_again_timeout(im); |
4359 | 1602 |
1603 serv_send_typing(gaim_conversation_get_gc(conv), | |
6695 | 1604 gaim_conversation_get_name(conv), |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
1605 GAIM_NOT_TYPING); |
4359 | 1606 } |
1607 else { | |
1608 /* We're deleting, but not all of it, so it counts as typing. */ | |
1609 got_typing_keypress(conv, FALSE); | |
1610 } | |
1611 } | |
1612 | |
1613 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1614 notebook_init_grab(GaimGtkWindow *gtkwin, GtkWidget *widget) |
4359 | 1615 { |
1616 static GdkCursor *cursor = NULL; | |
1617 | |
1618 gtkwin->in_drag = TRUE; | |
1619 | |
1620 if (gtkwin->drag_leave_signal) { | |
1621 g_signal_handler_disconnect(G_OBJECT(widget), | |
1622 gtkwin->drag_leave_signal); | |
1623 | |
1624 gtkwin->drag_leave_signal = 0; | |
1625 } | |
1626 | |
1627 if (cursor == NULL) | |
1628 cursor = gdk_cursor_new(GDK_FLEUR); | |
1629 | |
1630 /* Grab the pointer */ | |
1631 gtk_grab_add(gtkwin->notebook); | |
5114
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1632 #ifndef _WIN32 |
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1633 /* 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
|
1634 always be true after a button press. */ |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1635 if (!gdk_pointer_is_grabbed()) |
5114
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1636 #endif |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1637 gdk_pointer_grab(gtkwin->notebook->window, FALSE, |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1638 GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1639 NULL, cursor, GDK_CURRENT_TIME); |
4359 | 1640 } |
1641 | |
1642 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1643 notebook_motion_cb(GtkWidget *widget, GdkEventButton *e, GaimConvWindow *win) |
4359 | 1644 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1645 GaimGtkWindow *gtkwin; |
4359 | 1646 |
1647 gtkwin = GAIM_GTK_WINDOW(win); | |
1648 | |
1649 /* | |
1650 * Make sure the user moved the mouse far enough for the | |
1651 * drag to be initiated. | |
1652 */ | |
1653 if (gtkwin->in_predrag) { | |
1654 if (e->x_root < gtkwin->drag_min_x || | |
1655 e->x_root >= gtkwin->drag_max_x || | |
1656 e->y_root < gtkwin->drag_min_y || | |
1657 e->y_root >= gtkwin->drag_max_y) { | |
1658 | |
1659 gtkwin->in_predrag = FALSE; | |
1660 notebook_init_grab(gtkwin, widget); | |
1661 } | |
1662 } | |
1663 else { /* Otherwise, draw the arrows. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1664 GaimConvWindow *dest_win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1665 GaimGtkWindow *dest_gtkwin; |
4359 | 1666 GtkNotebook *dest_notebook; |
1667 GtkWidget *tab, *last_vis_tab = NULL; | |
1668 gint nb_x, nb_y, page_num, i, last_vis_tab_loc = -1; | |
1669 gint arrow1_x, arrow1_y, arrow2_x, arrow2_y; | |
1670 gboolean horiz_tabs = FALSE, tab_found = FALSE; | |
1671 GList *l; | |
1672 | |
1673 /* Get the window that the cursor is over. */ | |
1674 dest_win = gaim_gtkwin_get_at_xy(e->x_root, e->y_root); | |
1675 | |
1676 if (dest_win == NULL) { | |
1677 dnd_hints_hide_all(); | |
1678 | |
1679 return TRUE; | |
1680 } | |
1681 | |
1682 dest_gtkwin = GAIM_GTK_WINDOW(dest_win); | |
1683 | |
1684 dest_notebook = GTK_NOTEBOOK(dest_gtkwin->notebook); | |
1685 | |
1686 gdk_window_get_origin(GTK_WIDGET(dest_notebook)->window, &nb_x, &nb_y); | |
1687 | |
1688 arrow1_x = arrow2_x = nb_x; | |
1689 arrow1_y = arrow2_y = nb_y; | |
1690 | |
1691 page_num = gaim_gtkconv_get_dest_tab_at_xy(dest_win, | |
1692 e->x_root, e->y_root); | |
1693 | |
1694 if (gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_TOP || | |
1695 gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_BOTTOM) { | |
1696 | |
1697 horiz_tabs = TRUE; | |
1698 } | |
1699 | |
1700 /* Find out where to put the arrows. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1701 for (l = gaim_conv_window_get_conversations(dest_win), i = 0; |
4359 | 1702 l != NULL; |
1703 l = l->next, i++) { | |
1704 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1705 GaimConversation *conv = l->data; |
4359 | 1706 |
1707 tab = GAIM_GTK_CONVERSATION(conv)->tabby; | |
1708 | |
1709 /* | |
1710 * If this is the correct tab, record the positions | |
1711 * for the arrows. | |
1712 */ | |
1713 if (i == page_num) { | |
1714 if (horiz_tabs) { | |
1715 arrow1_x = arrow2_x = nb_x + tab->allocation.x; | |
1716 arrow1_y = nb_y + tab->allocation.y; | |
1717 arrow2_y = nb_y + tab->allocation.y + | |
1718 tab->allocation.height; | |
1719 } | |
1720 else { | |
1721 arrow1_x = nb_x + tab->allocation.x; | |
1722 arrow2_x = nb_x + tab->allocation.x + | |
1723 tab->allocation.width; | |
1724 arrow1_y = arrow2_y = nb_y + tab->allocation.y; | |
1725 } | |
1726 | |
1727 tab_found = TRUE; | |
1728 break; | |
1729 } | |
1730 else { /* Keep track of the right-most tab that we see. */ | |
1731 if (horiz_tabs && tab->allocation.x > last_vis_tab_loc) { | |
1732 last_vis_tab = tab; | |
1733 last_vis_tab_loc = tab->allocation.x; | |
1734 } | |
1735 else if (!horiz_tabs && tab->allocation.y > last_vis_tab_loc) { | |
1736 last_vis_tab = tab; | |
1737 last_vis_tab_loc = tab->allocation.y; | |
1738 } | |
1739 } | |
1740 } | |
1741 | |
1742 /* | |
1743 * If we didn't find the tab, then we'll just place the | |
1744 * arrows to the right/bottom of the last visible tab. | |
1745 */ | |
1746 if (!tab_found && last_vis_tab) { | |
1747 if (horiz_tabs) { | |
1748 arrow1_x = arrow2_x = nb_x + last_vis_tab->allocation.x + | |
1749 last_vis_tab->allocation.width; | |
1750 arrow1_y = nb_y + last_vis_tab->allocation.y; | |
1751 arrow2_y = nb_y + last_vis_tab->allocation.y + | |
1752 last_vis_tab->allocation.height; | |
1753 } | |
1754 else { | |
1755 arrow1_x = nb_x + last_vis_tab->allocation.x; | |
1756 arrow2_x = nb_x + last_vis_tab->allocation.x + | |
1757 last_vis_tab->allocation.width; | |
1758 arrow1_y = arrow2_y = nb_y + last_vis_tab->allocation.y + | |
1759 last_vis_tab->allocation.height; | |
1760 } | |
1761 } | |
1762 | |
1763 if (horiz_tabs) { | |
1764 dnd_hints_show(HINT_ARROW_DOWN, arrow1_x, arrow1_y); | |
1765 dnd_hints_show(HINT_ARROW_UP, arrow2_x, arrow2_y); | |
1766 } | |
1767 else { | |
1768 dnd_hints_show(HINT_ARROW_RIGHT, arrow1_x, arrow1_y); | |
1769 dnd_hints_show(HINT_ARROW_LEFT, arrow2_x, arrow2_y); | |
1770 } | |
1771 } | |
1772 | |
1773 return TRUE; | |
1774 } | |
1775 | |
1776 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1777 notebook_leave_cb(GtkWidget *widget, GdkEventCrossing *e, GaimConvWindow *win) |
4359 | 1778 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1779 GaimGtkWindow *gtkwin; |
4359 | 1780 |
1781 gtkwin = GAIM_GTK_WINDOW(win); | |
1782 | |
1783 if (gtkwin->in_drag) | |
1784 return FALSE; | |
1785 | |
1786 if (e->x_root < gtkwin->drag_min_x || | |
1787 e->x_root >= gtkwin->drag_max_x || | |
1788 e->y_root < gtkwin->drag_min_y || | |
1789 e->y_root >= gtkwin->drag_max_y) { | |
1790 | |
1791 gtkwin->in_predrag = FALSE; | |
1792 notebook_init_grab(gtkwin, widget); | |
1793 } | |
1794 | |
1795 return TRUE; | |
1796 } | |
1797 | |
1798 /* | |
1799 * THANK YOU GALEON! | |
1800 */ | |
1801 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1802 notebook_press_cb(GtkWidget *widget, GdkEventButton *e, GaimConvWindow *win) |
4359 | 1803 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1804 GaimGtkWindow *gtkwin; |
4359 | 1805 gint nb_x, nb_y, x_rel, y_rel; |
1806 GList *l; | |
1807 int tab_clicked; | |
1808 | |
1809 if (e->button != 1 || e->type != GDK_BUTTON_PRESS) | |
1810 return FALSE; | |
1811 | |
1812 gtkwin = GAIM_GTK_WINDOW(win); | |
1813 | |
1814 if (gtkwin->in_drag) { | |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1815 gaim_debug(GAIM_DEBUG_WARNING, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1816 "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
|
1817 return TRUE; |
4359 | 1818 } |
1819 | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1820 /* |
4359 | 1821 * Make sure a tab was actually clicked. The arrow buttons |
1822 * mess things up. | |
1823 */ | |
1824 tab_clicked = gaim_gtkconv_get_tab_at_xy(win, e->x_root, e->y_root); | |
1825 | |
1826 if (tab_clicked == -1) | |
1827 return FALSE; | |
1828 | |
1829 /* | |
1830 * Get the relative position of the press event, with regards to | |
1831 * the position of the notebook. | |
1832 */ | |
1833 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
1834 | |
1835 x_rel = e->x_root - nb_x; | |
1836 y_rel = e->y_root - nb_y; | |
1837 | |
1838 /* Reset the min/max x/y */ | |
1839 gtkwin->drag_min_x = 0; | |
1840 gtkwin->drag_min_y = 0; | |
1841 gtkwin->drag_max_x = 0; | |
1842 gtkwin->drag_max_y = 0; | |
1843 | |
1844 /* Find out which tab was dragged. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1845 for (l = gaim_conv_window_get_conversations(win); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1846 GaimConversation *conv = l->data; |
4359 | 1847 GtkWidget *tab = GAIM_GTK_CONVERSATION(conv)->tabby; |
1848 | |
1849 if (!GTK_WIDGET_VISIBLE(tab)) | |
1850 continue; | |
1851 | |
1852 if (tab->allocation.x > x_rel || tab->allocation.y > y_rel) | |
1853 break; | |
1854 | |
1855 /* Save the borders of the tab. */ | |
1856 gtkwin->drag_min_x = tab->allocation.x + nb_x; | |
1857 gtkwin->drag_min_y = tab->allocation.y + nb_y; | |
1858 gtkwin->drag_max_x = tab->allocation.width + gtkwin->drag_min_x; | |
1859 gtkwin->drag_max_y = tab->allocation.height + gtkwin->drag_min_y; | |
1860 } | |
1861 | |
1862 /* Make sure the click occurred in the tab. */ | |
1863 if (e->x_root < gtkwin->drag_min_x || | |
1864 e->x_root >= gtkwin->drag_max_x || | |
1865 e->y_root < gtkwin->drag_min_y || | |
1866 e->y_root >= gtkwin->drag_max_y) { | |
1867 | |
1868 return FALSE; | |
1869 } | |
1870 | |
1871 gtkwin->in_predrag = TRUE; | |
1872 | |
1873 /* Connect the new motion signals. */ | |
1874 gtkwin->drag_motion_signal = | |
1875 g_signal_connect(G_OBJECT(widget), "motion_notify_event", | |
1876 G_CALLBACK(notebook_motion_cb), win); | |
1877 | |
1878 gtkwin->drag_leave_signal = | |
1879 g_signal_connect(G_OBJECT(widget), "leave_notify_event", | |
1880 G_CALLBACK(notebook_leave_cb), win); | |
1881 | |
1882 return FALSE; | |
1883 } | |
1884 | |
1885 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1886 notebook_release_cb(GtkWidget *widget, GdkEventButton *e, GaimConvWindow *win) |
4359 | 1887 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1888 GaimConvWindow *dest_win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1889 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1890 GaimGtkWindow *dest_gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1891 GaimConversation *conv; |
4359 | 1892 GtkNotebook *dest_notebook; |
1893 gint dest_page_num; | |
1894 | |
1895 /* | |
1896 * Don't check to make sure that the event's window matches the | |
1897 * widget's, because we may be getting an event passed on from the | |
1898 * close button. | |
1899 */ | |
1900 if (e->button != 1 && e->type != GDK_BUTTON_RELEASE) | |
1901 return FALSE; | |
1902 | |
1903 if (gdk_pointer_is_grabbed()) { | |
1904 gdk_pointer_ungrab(GDK_CURRENT_TIME); | |
1905 gtk_grab_remove(widget); | |
1906 } | |
1907 | |
1908 gtkwin = GAIM_GTK_WINDOW(win); | |
1909 | |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1910 if (!gtkwin->in_predrag && !gtkwin->in_drag) |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1911 return FALSE; |
4359 | 1912 |
1913 /* Disconnect the motion signal. */ | |
1914 if (gtkwin->drag_motion_signal) { | |
1915 g_signal_handler_disconnect(G_OBJECT(widget), | |
1916 gtkwin->drag_motion_signal); | |
1917 | |
1918 gtkwin->drag_motion_signal = 0; | |
1919 } | |
1920 | |
1921 /* | |
1922 * If we're in a pre-drag, we'll also need to disconnect the leave | |
1923 * signal. | |
1924 */ | |
1925 if (gtkwin->in_predrag) { | |
1926 gtkwin->in_predrag = FALSE; | |
1927 | |
1928 if (gtkwin->drag_leave_signal) { | |
1929 g_signal_handler_disconnect(G_OBJECT(widget), | |
1930 gtkwin->drag_leave_signal); | |
1931 | |
1932 gtkwin->drag_leave_signal = 0; | |
1933 } | |
1934 } | |
1935 | |
1936 /* If we're not in drag... */ | |
1937 /* We're perfectly normal people! */ | |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1938 if (!gtkwin->in_drag) |
4359 | 1939 return FALSE; |
1940 | |
1941 gtkwin->in_drag = FALSE; | |
1942 | |
1943 dnd_hints_hide_all(); | |
1944 | |
4369
7e1fb422e5fd
[gaim-migrate @ 4635]
Christian Hammond <chipx86@chipx86.com>
parents:
4368
diff
changeset
|
1945 dest_win = gaim_gtkwin_get_at_xy(e->x_root, e->y_root); |
4359 | 1946 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1947 conv = gaim_conv_window_get_active_conversation(win); |
4359 | 1948 |
1949 if (dest_win == NULL) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1950 if (gaim_conv_window_get_conversation_count(win) < 2) |
4359 | 1951 return FALSE; |
1952 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1953 if (gaim_conv_window_get_conversation_count(win) > 1) { |
4359 | 1954 /* Make a new window to stick this to. */ |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1955 GaimConvWindow *new_win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1956 GaimGtkWindow *new_gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1957 GaimGtkConversation *gtkconv; |
4748
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1958 gint win_width, win_height; |
5121 | 1959 |
1960 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4359 | 1961 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1962 new_win = gaim_conv_window_new(); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1963 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1964 gaim_conv_window_add_conversation(new_win, |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1965 gaim_conv_window_remove_conversation(win, |
5139
d0182ae31ab8
[gaim-migrate @ 5503]
Christian Hammond <chipx86@chipx86.com>
parents:
5133
diff
changeset
|
1966 gaim_conversation_get_index(conv))); |
5121 | 1967 |
4748
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1968 new_gtkwin = GAIM_GTK_WINDOW(new_win); |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1969 |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1970 gtk_window_get_size(GTK_WINDOW(new_gtkwin->window), |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1971 &win_width, &win_height); |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1972 |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1973 gtk_window_move(GTK_WINDOW(new_gtkwin->window), |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1974 e->x_root - (win_width / 2), |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1975 e->y_root - (win_height / 2)); |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1976 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1977 gaim_conv_window_show(new_win); |
4359 | 1978 } |
1979 | |
1980 return TRUE; | |
1981 } | |
1982 | |
4369
7e1fb422e5fd
[gaim-migrate @ 4635]
Christian Hammond <chipx86@chipx86.com>
parents:
4368
diff
changeset
|
1983 dest_gtkwin = GAIM_GTK_WINDOW(dest_win); |
7e1fb422e5fd
[gaim-migrate @ 4635]
Christian Hammond <chipx86@chipx86.com>
parents:
4368
diff
changeset
|
1984 |
4359 | 1985 /* Get the destination notebook. */ |
1986 dest_notebook = GTK_NOTEBOOK(gtkwin->notebook); | |
1987 | |
1988 /* Get the destination page number. */ | |
1989 dest_page_num = gaim_gtkconv_get_dest_tab_at_xy(dest_win, | |
7143 | 1990 e->x_root, e->y_root); |
4359 | 1991 |
1992 if (win == dest_win) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1993 gaim_conv_window_move_conversation(win, |
4359 | 1994 gaim_conversation_get_index(conv), dest_page_num); |
1995 } | |
1996 else { | |
1997 size_t pos; | |
1998 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1999 gaim_conv_window_remove_conversation(win, |
4359 | 2000 gaim_conversation_get_index(conv)); |
2001 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2002 pos = gaim_conv_window_add_conversation(dest_win, conv); |
4359 | 2003 |
5901
74e273e22f94
[gaim-migrate @ 6333]
Christian Hammond <chipx86@chipx86.com>
parents:
5881
diff
changeset
|
2004 if (pos != dest_page_num) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2005 gaim_conv_window_move_conversation(dest_win, pos, dest_page_num); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2006 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2007 gaim_conv_window_switch_conversation(dest_win, dest_page_num); |
4359 | 2008 } |
2009 | |
2010 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
2011 | |
2012 return TRUE; | |
2013 } | |
2014 | |
7143 | 2015 static GdkPixbuf *get_tab_icon(GaimConversation *conv) |
2016 { | |
2017 GaimAccount *account = gaim_conversation_get_account(conv); | |
2018 const char *name = gaim_conversation_get_name(conv); | |
2019 GdkPixbuf *status = NULL; | |
2020 | |
2021 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
2022 GaimBuddy *b = gaim_find_buddy(account, name); | |
2023 if (b != NULL) { | |
2024 status = gaim_gtk_blist_get_status_icon((GaimBlistNode*)b, | |
2025 GAIM_STATUS_ICON_SMALL); | |
2026 } | |
2027 } | |
2028 | |
2029 if (!status) { | |
2030 GdkPixbuf *pixbuf; | |
2031 pixbuf = create_prpl_icon(account); | |
2032 | |
2033 if (pixbuf) { | |
2034 status = gdk_pixbuf_scale_simple(pixbuf, 15, 15, | |
2035 GDK_INTERP_BILINEAR); | |
2036 g_object_unref(pixbuf); | |
2037 } | |
2038 } | |
2039 return status; | |
2040 } | |
2041 | |
7887 | 2042 /* |
2043 * Makes sure all the menu items and all the buttons are hidden/shown and | |
2044 * sensitive/insensitve. This is called after changing tabs and when an | |
2045 * account signs on or off. | |
2046 */ | |
4359 | 2047 static void |
7887 | 2048 gray_stuff_out(GaimConversation *conv) |
4359 | 2049 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2050 GaimConvWindow *win; |
7887 | 2051 GaimGtkWindow *gtkwin; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2052 GaimGtkConversation *gtkconv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2053 GaimConnection *gc; |
7887 | 2054 GaimPluginProtocolInfo *prpl_info = NULL; |
7222 | 2055 GdkPixbuf *window_icon = NULL; |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2056 |
7887 | 2057 win = gaim_conversation_get_window(conv); |
4359 | 2058 gtkwin = GAIM_GTK_WINDOW(win); |
2059 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7887 | 2060 gc = gaim_conversation_get_gc(conv); |
4359 | 2061 |
7879 | 2062 if (gc != NULL) |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
2063 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2064 |
7887 | 2065 if (gtkwin->menu.send_as != NULL) |
2066 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); | |
2067 | |
2068 /* | |
2069 * Handle hiding and showing stuff based on what type of conv this is. | |
7929 | 2070 * Stuff that Gaim IMs support in general should be shown for IM |
2071 * conversations. Stuff that Gaim chats support in gerneal should be | |
2072 * shown for chat conversations. It doesn't matter whether the PRPL | |
2073 * supports it or not--that only affects if the button or menu item | |
2074 * is sensitive or not. | |
7887 | 2075 */ |
4359 | 2076 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
7887 | 2077 /* Show stuff that applies to IMs, hide stuff that applies to chats */ |
2078 | |
2079 /* Deal with buttons */ | |
2080 gtk_widget_show(gtkconv->info); | |
2081 gtk_widget_show(gtkconv->send); | |
2082 gtk_widget_show(gtkconv->u.im->warn); | |
2083 gtk_widget_show(gtkconv->u.im->block); | |
2084 | |
2085 /* Deal with the toolbar */ | |
2086 gtk_widget_show(gtkconv->toolbar.image); | |
2087 | |
2088 /* Deal with menu items */ | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2089 gtk_widget_show(gtkwin->menu.view_log); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2090 gtk_widget_show(gtkwin->menu.add_pounce); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2091 gtk_widget_show(gtkwin->menu.get_info); |
7887 | 2092 gtk_widget_show(gtkwin->menu.warn); |
7859 | 2093 gtk_widget_hide(gtkwin->menu.invite); |
7887 | 2094 gtk_widget_show(gtkwin->menu.alias); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2095 gtk_widget_show(gtkwin->menu.block); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2096 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2097 if (gaim_find_buddy(gaim_conversation_get_account(conv), |
7143 | 2098 gaim_conversation_get_name(conv)) == NULL) { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2099 gtk_widget_show(gtkwin->menu.add); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2100 gtk_widget_hide(gtkwin->menu.remove); |
7929 | 2101 gtk_widget_show(gtkconv->add); |
2102 gtk_widget_hide(gtkconv->remove); | |
7859 | 2103 } else { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2104 gtk_widget_show(gtkwin->menu.remove); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2105 gtk_widget_hide(gtkwin->menu.add); |
7929 | 2106 gtk_widget_hide(gtkconv->add); |
2107 gtk_widget_show(gtkconv->remove); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2108 } |
7887 | 2109 |
2110 gtk_widget_show(gtkwin->menu.insert_link); | |
2111 gtk_widget_show(gtkwin->menu.insert_image); | |
2112 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
2113 /* Show stuff that applies to IMs, hide stuff that applies to chats */ | |
2114 | |
2115 /* Deal with buttons */ | |
2116 gtk_widget_hide(gtkconv->info); | |
2117 gtk_widget_show(gtkconv->send); | |
2118 gtk_widget_show(gtkconv->u.chat->invite); | |
2119 | |
2120 /* Deal with the toolbar */ | |
2121 gtk_widget_hide(gtkconv->toolbar.image); | |
2122 | |
2123 /* Deal with menu items */ | |
7859 | 2124 gtk_widget_hide(gtkwin->menu.view_log); |
2125 gtk_widget_hide(gtkwin->menu.add_pounce); | |
2126 gtk_widget_hide(gtkwin->menu.get_info); | |
7887 | 2127 gtk_widget_hide(gtkwin->menu.warn); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2128 gtk_widget_show(gtkwin->menu.invite); |
7887 | 2129 gtk_widget_show(gtkwin->menu.alias); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2130 gtk_widget_hide(gtkwin->menu.block); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2131 |
7879 | 2132 if (gaim_blist_find_chat(gaim_conversation_get_account(conv), |
2133 gaim_conversation_get_name(conv)) == NULL) { | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2134 gtk_widget_show(gtkwin->menu.add); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2135 gtk_widget_hide(gtkwin->menu.remove); |
7929 | 2136 gtk_widget_show(gtkconv->add); |
2137 gtk_widget_hide(gtkconv->remove); | |
7859 | 2138 } else { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2139 gtk_widget_show(gtkwin->menu.remove); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2140 gtk_widget_hide(gtkwin->menu.add); |
7929 | 2141 gtk_widget_hide(gtkconv->add); |
2142 gtk_widget_show(gtkconv->remove); | |
7887 | 2143 } |
2144 | |
2145 gtk_widget_show(gtkwin->menu.insert_link); | |
2146 gtk_widget_hide(gtkwin->menu.insert_image); | |
2147 } | |
2148 | |
2149 /* | |
2150 * Handle graying stuff out based on whether an account is connected | |
2151 * and what features that account supports. | |
2152 */ | |
2153 if (gc != NULL) { | |
2154 /* Account is online */ | |
2155 | |
2156 /* Deal with buttons */ | |
7929 | 2157 gtk_widget_set_sensitive(gtkconv->add, TRUE); |
2158 gtk_widget_set_sensitive(gtkconv->remove, TRUE); | |
7887 | 2159 gtk_widget_set_sensitive(gtkconv->info, (prpl_info->get_info != NULL)); |
7929 | 2160 |
7887 | 2161 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
7929 | 2162 gtk_widget_set_sensitive(gtkconv->send, (prpl_info->send_im != NULL)); |
7887 | 2163 gtk_widget_set_sensitive(gtkconv->u.im->warn, |
2164 (prpl_info->warn != NULL)); | |
2165 gtk_widget_set_sensitive(gtkconv->u.im->block, | |
2166 (prpl_info->add_deny != NULL)); | |
2167 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
2168 gtk_widget_set_sensitive(gtkconv->send, (prpl_info->chat_send != NULL)); | |
2169 gtk_widget_set_sensitive(gtkconv->u.chat->invite, | |
2170 (prpl_info->chat_invite != NULL)); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2171 } |
7887 | 2172 |
2173 /* Deal with the toolbar */ | |
7929 | 2174 gtk_widget_set_sensitive(gtkconv->toolbar.link, TRUE); |
7887 | 2175 gtk_widget_set_sensitive(gtkconv->toolbar.image, |
2176 (prpl_info->options & OPT_PROTO_IM_IMAGE)); | |
7888 | 2177 gtk_widget_set_sensitive(gtkconv->toolbar.bgcolor, |
2178 !(gc->flags & GAIM_CONNECTION_NO_BGCOLOR)); | |
7887 | 2179 |
2180 /* Deal with menu items */ | |
2181 gtk_widget_set_sensitive(gtkwin->menu.view_log, TRUE); | |
2182 gtk_widget_set_sensitive(gtkwin->menu.add_pounce, TRUE); | |
2183 gtk_widget_set_sensitive(gtkwin->menu.get_info, (prpl_info->get_info != NULL)); | |
2184 gtk_widget_set_sensitive(gtkwin->menu.warn, (prpl_info->warn != NULL)); | |
2185 gtk_widget_set_sensitive(gtkwin->menu.invite, | |
2186 (prpl_info->chat_invite != NULL)); | |
2187 | |
2188 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
2189 if (gaim_find_buddy(gaim_conversation_get_account(conv), | |
2190 gaim_conversation_get_name(conv)) == NULL) | |
2191 gtk_widget_set_sensitive(gtkwin->menu.alias, FALSE); | |
2192 else | |
2193 gtk_widget_set_sensitive(gtkwin->menu.alias, TRUE); | |
2194 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
2195 if (gaim_blist_find_chat(gaim_conversation_get_account(conv), | |
2196 gaim_conversation_get_name(conv)) == NULL) | |
2197 gtk_widget_set_sensitive(gtkwin->menu.alias, FALSE); | |
2198 else | |
2199 gtk_widget_set_sensitive(gtkwin->menu.alias, TRUE); | |
2200 } | |
2201 | |
7931 | 2202 gtk_widget_set_sensitive(gtkwin->menu.block, (prpl_info->add_deny != NULL)); |
7887 | 2203 gtk_widget_set_sensitive(gtkwin->menu.add, TRUE); |
7859 | 2204 gtk_widget_set_sensitive(gtkwin->menu.remove, TRUE); |
7887 | 2205 gtk_widget_set_sensitive(gtkwin->menu.insert_link, TRUE); |
2206 gtk_widget_set_sensitive(gtkwin->menu.insert_image, | |
2207 (prpl_info->options & OPT_PROTO_IM_IMAGE)); | |
2208 } else { | |
2209 /* Account is offline */ | |
2210 | |
2211 /* Deal with buttons */ | |
7929 | 2212 gtk_widget_set_sensitive(gtkconv->add, FALSE); |
2213 gtk_widget_set_sensitive(gtkconv->remove, FALSE); | |
7887 | 2214 gtk_widget_set_sensitive(gtkconv->info, FALSE); |
2215 gtk_widget_set_sensitive(gtkconv->send, FALSE); | |
2216 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
2217 gtk_widget_set_sensitive(gtkconv->u.im->warn, FALSE); | |
2218 gtk_widget_set_sensitive(gtkconv->u.im->block, FALSE); | |
2219 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
2220 gtk_widget_set_sensitive(gtkconv->u.chat->invite, FALSE); | |
2221 } | |
2222 | |
2223 /* Deal with the toolbar */ | |
7929 | 2224 gtk_widget_set_sensitive(gtkconv->toolbar.link, TRUE); |
7887 | 2225 gtk_widget_set_sensitive(gtkconv->toolbar.image, FALSE); |
2226 | |
2227 /* Then deal with menu items */ | |
2228 gtk_widget_set_sensitive(gtkwin->menu.view_log, TRUE); | |
2229 gtk_widget_set_sensitive(gtkwin->menu.add_pounce, TRUE); | |
2230 gtk_widget_set_sensitive(gtkwin->menu.get_info, FALSE); | |
2231 gtk_widget_set_sensitive(gtkwin->menu.warn, FALSE); | |
2232 gtk_widget_set_sensitive(gtkwin->menu.invite, FALSE); | |
2233 gtk_widget_set_sensitive(gtkwin->menu.alias, FALSE); | |
2234 gtk_widget_set_sensitive(gtkwin->menu.block, FALSE); | |
2235 gtk_widget_set_sensitive(gtkwin->menu.add, FALSE); | |
2236 gtk_widget_set_sensitive(gtkwin->menu.remove, FALSE); | |
7929 | 2237 gtk_widget_set_sensitive(gtkwin->menu.insert_link, TRUE); |
7887 | 2238 gtk_widget_set_sensitive(gtkwin->menu.insert_image, FALSE); |
2239 } | |
2240 | |
2241 /* | |
2242 * Update the window's icon | |
2243 */ | |
2244 if ((gaim_conversation_get_type(conv) == GAIM_CONV_IM) && (gtkconv->u.im->anim)) { | |
2245 window_icon = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); | |
2246 g_object_ref(window_icon); | |
2247 } else { | |
7219 | 2248 window_icon = get_tab_icon(conv); |
4359 | 2249 } |
7887 | 2250 gtk_window_set_icon(GTK_WINDOW(gtkwin->window), window_icon); |
2251 g_object_unref(G_OBJECT(window_icon)); | |
2252 } | |
2253 | |
2254 static void | |
2255 switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, | |
2256 gpointer user_data) | |
2257 { | |
2258 GaimConvWindow *win; | |
2259 GaimConversation *conv; | |
2260 GaimGtkConversation *gtkconv; | |
2261 GaimGtkWindow *gtkwin; | |
2262 | |
2263 win = (GaimConvWindow *)user_data; | |
2264 conv = gaim_conv_window_get_conversation_at(win, page_num); | |
2265 | |
2266 g_return_if_fail(conv != NULL); | |
2267 | |
2268 gtkwin = GAIM_GTK_WINDOW(win); | |
2269 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2270 | |
2271 gaim_conversation_set_unseen(conv, GAIM_UNSEEN_NONE); | |
2272 | |
2273 /* Update the menubar */ | |
2274 gray_stuff_out(conv); | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2275 |
4736 | 2276 update_typing_icon(conv); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2277 |
4359 | 2278 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.logging), |
7143 | 2279 gaim_conversation_is_logging(conv)); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2280 |
4359 | 2281 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.sounds), |
7143 | 2282 gtkconv->make_sound); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2283 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2284 gtk_check_menu_item_set_active( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2285 GTK_CHECK_MENU_ITEM(gtkwin->menu.show_formatting_toolbar), |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2286 gtkconv->show_formatting_toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2287 |
4359 | 2288 gtk_widget_grab_focus(gtkconv->entry); |
4681 | 2289 |
4965 | 2290 gtk_window_set_title(GTK_WINDOW(gtkwin->window), |
7143 | 2291 gtk_label_get_text(GTK_LABEL(gtkconv->tab_label))); |
4359 | 2292 } |
2293 | |
2294 /************************************************************************** | |
2295 * Utility functions | |
2296 **************************************************************************/ | |
2297 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2298 do_bold(GtkWidget *bold, GaimGtkConversation *gtkconv) |
4359 | 2299 { |
7695 | 2300 gtk_imhtml_toggle_bold(GTK_IMHTML(gtkconv->entry)); |
4359 | 2301 gtk_widget_grab_focus(gtkconv->entry); |
2302 } | |
2303 | |
2304 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2305 do_italic(GtkWidget *italic, GaimGtkConversation *gtkconv) |
4359 | 2306 { |
7695 | 2307 gtk_imhtml_toggle_italic(GTK_IMHTML(gtkconv->entry)); |
4359 | 2308 gtk_widget_grab_focus(gtkconv->entry); |
2309 } | |
2310 | |
2311 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2312 do_underline(GtkWidget *underline, GaimGtkConversation *gtkconv) |
4359 | 2313 { |
7695 | 2314 gtk_imhtml_toggle_underline(GTK_IMHTML(gtkconv->entry)); |
4359 | 2315 gtk_widget_grab_focus(gtkconv->entry); |
2316 } | |
2317 | |
2318 static void | |
7242
59ffe137176d
[gaim-migrate @ 7817]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7222
diff
changeset
|
2319 do_small(GtkWidget *smalltb, GaimGtkConversation *gtkconv) |
4359 | 2320 { |
7740 | 2321 gtk_imhtml_font_shrink(GTK_IMHTML(gtkconv->entry)); |
4359 | 2322 gtk_widget_grab_focus(gtkconv->entry); |
2323 } | |
2324 | |
2325 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2326 do_big(GtkWidget *large, GaimGtkConversation *gtkconv) |
4359 | 2327 { |
7740 | 2328 gtk_imhtml_font_grow(GTK_IMHTML(gtkconv->entry)); |
4359 | 2329 gtk_widget_grab_focus(gtkconv->entry); |
2330 } | |
2331 | |
2332 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2333 toggle_font(GtkWidget *font, GaimConversation *conv) |
4359 | 2334 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2335 GaimGtkConversation *gtkconv; |
4359 | 2336 |
2337 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2338 | |
7717 | 2339 show_font_dialog(conv, font); |
4359 | 2340 } |
2341 | |
2342 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2343 toggle_fg_color(GtkWidget *color, GaimConversation *conv) |
4359 | 2344 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2345 GaimGtkConversation *gtkconv; |
4359 | 2346 |
2347 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2348 | |
2349 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(color))) | |
2350 show_fgcolor_dialog(conv, color); | |
2351 else if (gtkconv->dialogs.fg_color != NULL) | |
2352 cancel_fgcolor(color, conv); | |
2353 else | |
2354 gaim_gtk_advance_past(gtkconv, "<FONT COLOR>", "</FONT>"); | |
2355 } | |
2356 | |
2357 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2358 toggle_bg_color(GtkWidget *color, GaimConversation *conv) |
4359 | 2359 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2360 GaimGtkConversation *gtkconv; |
4359 | 2361 |
2362 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2363 | |
2364 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(color))) | |
2365 show_bgcolor_dialog(conv, color); | |
2366 else if (gtkconv->dialogs.bg_color != NULL) | |
2367 cancel_bgcolor(color, conv); | |
2368 else | |
2369 gaim_gtk_advance_past(gtkconv, "<BODY BGCOLOR>", "</BODY>"); | |
2370 } | |
2371 | |
2372 static void | |
2373 check_everything(GtkTextBuffer *buffer) | |
2374 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2375 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2376 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2377 |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2378 conv = (GaimConversation *)g_object_get_data(G_OBJECT(buffer), |
4359 | 2379 "user_data"); |
2380 | |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2381 g_return_if_fail(conv != NULL); |
4359 | 2382 |
2383 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2384 | |
2385 /* CONV TODO */ | |
2386 } | |
2387 | |
2388 static void | |
4685 | 2389 set_toggle(GtkWidget *tb, gboolean active) |
4359 | 2390 { |
2391 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(tb), active); | |
2392 } | |
2393 | |
2394 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2395 got_typing_keypress(GaimConversation *conv, gboolean first) |
4359 | 2396 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2397 GaimConvIm *im; |
4685 | 2398 |
4359 | 2399 /* |
2400 * 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
|
2401 * send GAIM_TYPED any time soon. |
4359 | 2402 */ |
2403 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2404 im = GAIM_CONV_IM(conv); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2405 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2406 if (gaim_conv_im_get_type_again_timeout(im)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2407 gaim_conv_im_stop_type_again_timeout(im); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2408 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2409 gaim_conv_im_start_type_again_timeout(im); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2410 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2411 if (first || (gaim_conv_im_get_type_again(im) != 0 && |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2412 time(NULL) > gaim_conv_im_get_type_again(im))) { |
4359 | 2413 |
2414 int timeout = serv_send_typing(gaim_conversation_get_gc(conv), | |
2415 (char *)gaim_conversation_get_name(conv), | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
2416 GAIM_TYPING); |
4359 | 2417 |
2418 if (timeout) | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2419 gaim_conv_im_set_type_again(im, time(NULL) + timeout); |
4359 | 2420 else |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2421 gaim_conv_im_set_type_again(im, 0); |
4359 | 2422 } |
2423 } | |
2424 | |
4736 | 2425 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2426 update_typing_icon(GaimConversation *conv) |
4736 | 2427 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2428 GaimGtkWindow *gtkwin; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2429 GaimConvIm *im = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2430 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); |
4736 | 2431 |
2432 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); | |
2433 | |
2434 if(gaim_conversation_get_type(conv) == GAIM_CONV_IM) | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2435 im = GAIM_CONV_IM(conv); |
4736 | 2436 |
2437 if(gtkwin->menu.typing_icon) { | |
2438 gtk_widget_destroy(gtkwin->menu.typing_icon); | |
2439 gtkwin->menu.typing_icon = NULL; | |
2440 } | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2441 if(im && gaim_conv_im_get_typing_state(im) == GAIM_TYPING) { |
4736 | 2442 gtkwin->menu.typing_icon = gtk_image_menu_item_new(); |
2443 gtk_image_menu_item_set_image( | |
2444 GTK_IMAGE_MENU_ITEM(gtkwin->menu.typing_icon), | |
2445 gtk_image_new_from_stock(GAIM_STOCK_TYPING, | |
2446 GTK_ICON_SIZE_MENU)); | |
4757 | 2447 gtk_tooltips_set_tip(gtkconv->tooltips, gtkwin->menu.typing_icon, |
4736 | 2448 _("User is typing..."), NULL); |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2449 } else if(im && gaim_conv_im_get_typing_state(im) == GAIM_TYPED) { |
4736 | 2450 gtkwin->menu.typing_icon = gtk_image_menu_item_new(); |
2451 gtk_image_menu_item_set_image( | |
2452 GTK_IMAGE_MENU_ITEM(gtkwin->menu.typing_icon), | |
2453 gtk_image_new_from_stock(GAIM_STOCK_TYPED, | |
2454 GTK_ICON_SIZE_MENU)); | |
4757 | 2455 gtk_tooltips_set_tip(gtkconv->tooltips, gtkwin->menu.typing_icon, |
4736 | 2456 _("User has typed something and paused"), NULL); |
2457 } | |
2458 | |
2459 if(gtkwin->menu.typing_icon) { | |
2460 gtk_menu_item_set_right_justified( | |
2461 GTK_MENU_ITEM(gtkwin->menu.typing_icon), TRUE); | |
2462 gtk_widget_show_all(gtkwin->menu.typing_icon); | |
2463 gtk_menu_shell_append(GTK_MENU_SHELL(gtkwin->menu.menubar), | |
2464 gtkwin->menu.typing_icon); | |
2465 } | |
2466 } | |
2467 | |
4685 | 2468 static gboolean |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2469 update_send_as_selection(GaimConvWindow *win) |
4359 | 2470 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2471 GaimAccount *account; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2472 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2473 GaimGtkWindow *gtkwin; |
4359 | 2474 GtkWidget *menu; |
2475 GList *child; | |
2476 | |
7090
04f9f7440bc3
[gaim-migrate @ 7655]
Christian Hammond <chipx86@chipx86.com>
parents:
7089
diff
changeset
|
2477 if (g_list_find(gaim_get_windows(), win) == NULL) |
04f9f7440bc3
[gaim-migrate @ 7655]
Christian Hammond <chipx86@chipx86.com>
parents:
7089
diff
changeset
|
2478 return FALSE; |
4849 | 2479 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2480 conv = gaim_conv_window_get_active_conversation(win); |
4359 | 2481 |
5860
52d5fad43950
[gaim-migrate @ 6291]
Christian Hammond <chipx86@chipx86.com>
parents:
5858
diff
changeset
|
2482 if (conv == NULL) |
52d5fad43950
[gaim-migrate @ 6291]
Christian Hammond <chipx86@chipx86.com>
parents:
5858
diff
changeset
|
2483 return FALSE; |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2484 |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2485 account = gaim_conversation_get_account(conv); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2486 gtkwin = GAIM_GTK_WINDOW(win); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2487 |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2488 if (gtkwin->menu.send_as == NULL) |
4685 | 2489 return FALSE; |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2490 |
4359 | 2491 gtk_widget_show(gtkwin->menu.send_as); |
2492 | |
2493 menu = gtk_menu_item_get_submenu( | |
2494 GTK_MENU_ITEM(gtkwin->menu.send_as)); | |
2495 | |
2496 for (child = gtk_container_get_children(GTK_CONTAINER(menu)); | |
2497 child != NULL; | |
2498 child = child->next) { | |
2499 | |
2500 GtkWidget *item = child->data; | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2501 GaimAccount *item_account = g_object_get_data(G_OBJECT(item), |
4673 | 2502 "gaim_account"); |
2503 | |
2504 if (account == item_account) { | |
4359 | 2505 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE); |
2506 break; | |
2507 } | |
2508 } | |
6030
54c37db13279
[gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents:
6016
diff
changeset
|
2509 |
4685 | 2510 return FALSE; |
4359 | 2511 } |
2512 | |
2513 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2514 generate_send_as_items(GaimConvWindow *win, GaimConversation *deleted_conv) |
4359 | 2515 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2516 GaimGtkWindow *gtkwin; |
4359 | 2517 GtkWidget *menu; |
2518 GtkWidget *menuitem; | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2519 GList *gcs; |
4359 | 2520 GList *convs; |
2521 GSList *group = NULL; | |
2522 gboolean first_offline = TRUE; | |
2523 gboolean found_online = FALSE; | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2524 GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
4359 | 2525 |
2526 gtkwin = GAIM_GTK_WINDOW(win); | |
2527 | |
2528 if (gtkwin->menu.send_as != NULL) | |
2529 gtk_widget_destroy(gtkwin->menu.send_as); | |
2530 | |
2531 /* See if we have > 1 connection active. */ | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2532 if (g_list_length(gaim_connections_get_all()) < 2) { |
4359 | 2533 /* Now make sure we don't have any Offline entries. */ |
2534 gboolean found_offline = FALSE; | |
2535 | |
2536 for (convs = gaim_get_conversations(); | |
2537 convs != NULL; | |
2538 convs = convs->next) { | |
2539 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2540 GaimConversation *conv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2541 GaimAccount *account; |
4491 | 2542 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2543 conv = (GaimConversation *)convs->data; |
4491 | 2544 account = gaim_conversation_get_account(conv); |
2545 | |
6495
8ce66049ce68
[gaim-migrate @ 7010]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
2546 if (account != NULL && account->gc == NULL) { |
4359 | 2547 found_offline = TRUE; |
2548 break; | |
2549 } | |
2550 } | |
2551 | |
2552 if (!found_offline) { | |
2553 gtkwin->menu.send_as = NULL; | |
2554 return; | |
2555 } | |
2556 } | |
2557 | |
2558 /* Build the Send As menu */ | |
2559 gtkwin->menu.send_as = gtk_menu_item_new_with_mnemonic(_("_Send As")); | |
2560 gtk_widget_show(gtkwin->menu.send_as); | |
2561 | |
2562 menu = gtk_menu_new(); | |
7857
43f63ff8a6d8
[gaim-migrate @ 8511]
Christian Hammond <chipx86@chipx86.com>
parents:
7855
diff
changeset
|
2563 gtk_menu_shell_insert(GTK_MENU_SHELL(gtkwin->menu.menubar), |
43f63ff8a6d8
[gaim-migrate @ 8511]
Christian Hammond <chipx86@chipx86.com>
parents:
7855
diff
changeset
|
2564 gtkwin->menu.send_as, 2); |
4359 | 2565 gtk_menu_item_set_submenu(GTK_MENU_ITEM(gtkwin->menu.send_as), menu); |
2566 | |
2567 gtk_widget_show(menu); | |
2568 | |
2569 /* Fill it with entries. */ | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2570 for (gcs = gaim_connections_get_all(); gcs != NULL; gcs = gcs->next) { |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2571 |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2572 GaimConnection *gc; |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2573 GaimAccount *account; |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2574 GtkWidget *box; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2575 GtkWidget *label; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2576 GtkWidget *image; |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2577 GdkPixbuf *pixbuf, *scale; |
4359 | 2578 |
2579 found_online = TRUE; | |
2580 | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2581 gc = (GaimConnection *)gcs->data; |
4359 | 2582 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2583 /* Create a pixmap for the protocol icon. */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2584 pixbuf = create_prpl_icon(gc->account); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2585 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
|
2586 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2587 /* Now convert it to GtkImage */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2588 if (pixbuf == NULL) |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2589 image = gtk_image_new(); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2590 else |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2591 image = gtk_image_new_from_pixbuf(scale); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2592 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2593 gtk_size_group_add_widget(sg, image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2594 |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2595 g_object_unref(G_OBJECT(scale)); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2596 g_object_unref(G_OBJECT(pixbuf)); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2597 |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2598 account = gaim_connection_get_account(gc); |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2599 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2600 /* Make our menu item */ |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2601 menuitem = gtk_radio_menu_item_new_with_label(group, |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2602 gaim_account_get_username(account)); |
4793 | 2603 group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem)); |
4359 | 2604 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2605 /* Do some evil, see some evil, speak some evil. */ |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2606 box = gtk_hbox_new(FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2607 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2608 label = gtk_bin_get_child(GTK_BIN(menuitem)); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2609 g_object_ref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2610 gtk_container_remove(GTK_CONTAINER(menuitem), label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2611 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2612 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2613 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 4); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2614 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2615 g_object_unref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2616 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2617 gtk_container_add(GTK_CONTAINER(menuitem), box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2618 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2619 gtk_widget_show(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2620 gtk_widget_show(image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2621 gtk_widget_show(box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2622 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2623 /* Set our data and callbacks. */ |
4359 | 2624 g_object_set_data(G_OBJECT(menuitem), "user_data", win); |
4673 | 2625 g_object_set_data(G_OBJECT(menuitem), "gaim_account", gc->account); |
4359 | 2626 |
4786 | 2627 g_signal_connect(G_OBJECT(menuitem), "activate", |
4673 | 2628 G_CALLBACK(menu_conv_sel_send_cb), NULL); |
4359 | 2629 |
2630 gtk_widget_show(menuitem); | |
2631 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
2632 } | |
2633 | |
2634 /* | |
2635 * Fill it with any accounts that still has an open (yet disabled) window | |
2636 * (signed off accounts with a window open). | |
2637 */ | |
2638 for (convs = gaim_get_conversations(); | |
2639 convs != NULL; | |
2640 convs = convs->next) { | |
2641 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2642 GaimConversation *conv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2643 GaimAccount *account; |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2644 GtkWidget *box; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2645 GtkWidget *label; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2646 GtkWidget *image; |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2647 GdkPixbuf *pixbuf, *scale; |
4359 | 2648 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2649 conv = (GaimConversation *)convs->data; |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
2650 |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
2651 if (conv == deleted_conv) |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
2652 continue; |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
2653 |
4491 | 2654 account = gaim_conversation_get_account(conv); |
2655 | |
6495
8ce66049ce68
[gaim-migrate @ 7010]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
2656 if (account != NULL && account->gc == NULL) { |
4359 | 2657 if (first_offline && found_online) { |
2658 menuitem = gtk_separator_menu_item_new(); | |
2659 gtk_widget_show(menuitem); | |
2660 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
2661 | |
2662 first_offline = FALSE; | |
2663 } | |
2664 | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2665 /* Create a pixmap for the protocol icon. */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2666 pixbuf = create_prpl_icon(account); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2667 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2668 GDK_INTERP_BILINEAR); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2669 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2670 /* Now convert it to GtkImage */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2671 if (pixbuf == NULL) |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2672 image = gtk_image_new(); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2673 else |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2674 image = gtk_image_new_from_pixbuf(scale); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2675 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2676 gtk_size_group_add_widget(sg, image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2677 |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2678 if (scale != NULL) g_object_unref(scale); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2679 if (pixbuf != NULL) g_object_unref(pixbuf); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2680 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2681 /* Make our menu item */ |
4359 | 2682 menuitem = gtk_radio_menu_item_new_with_label(group, |
4491 | 2683 account->username); |
4793 | 2684 group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem)); |
4359 | 2685 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2686 /* Do some evil, see some evil, speak some evil. */ |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2687 box = gtk_hbox_new(FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2688 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2689 label = gtk_bin_get_child(GTK_BIN(menuitem)); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2690 g_object_ref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2691 gtk_container_remove(GTK_CONTAINER(menuitem), label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2692 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2693 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2694 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 4); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2695 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2696 g_object_unref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2697 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2698 gtk_container_add(GTK_CONTAINER(menuitem), box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2699 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2700 gtk_widget_show(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2701 gtk_widget_show(image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2702 gtk_widget_show(box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2703 |
4359 | 2704 gtk_widget_set_sensitive(menuitem, FALSE); |
4786 | 2705 g_object_set_data(G_OBJECT(menuitem), "user_data", win); |
4674 | 2706 g_object_set_data(G_OBJECT(menuitem), "gaim_account", account); |
4359 | 2707 |
4786 | 2708 g_signal_connect(G_OBJECT(menuitem), "activate", |
5902
6889b89cab90
[gaim-migrate @ 6334]
Christian Hammond <chipx86@chipx86.com>
parents:
5901
diff
changeset
|
2709 G_CALLBACK(menu_conv_sel_send_cb), NULL); |
4786 | 2710 |
4359 | 2711 gtk_widget_show(menuitem); |
2712 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
2713 } | |
2714 } | |
2715 | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2716 g_object_unref(sg); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2717 |
4359 | 2718 gtk_widget_show(gtkwin->menu.send_as); |
2719 update_send_as_selection(win); | |
2720 } | |
2721 | |
2722 static GList * | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2723 generate_invite_user_names(GaimConnection *gc) |
4359 | 2724 { |
6695 | 2725 GaimBlistNode *gnode,*cnode,*bnode; |
4359 | 2726 static GList *tmp = NULL; |
2727 | |
2728 if (tmp) | |
2729 g_list_free(tmp); | |
2730 | |
2731 tmp = g_list_append(NULL, ""); | |
2732 | |
2733 if (gc != NULL) { | |
4785 | 2734 for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { |
2735 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) | |
2736 continue; | |
6695 | 2737 for(cnode = gnode->child; cnode; cnode = cnode->next) { |
2738 if(!GAIM_BLIST_NODE_IS_CONTACT(cnode)) | |
4785 | 2739 continue; |
6695 | 2740 for(bnode = cnode->child; bnode; bnode = bnode->next) { |
2741 GaimBuddy *buddy; | |
2742 | |
2743 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) | |
2744 continue; | |
2745 | |
2746 buddy = (GaimBuddy *)bnode; | |
2747 | |
2748 if (buddy->account == gc->account && | |
2749 GAIM_BUDDY_IS_ONLINE(buddy)) | |
2750 tmp = g_list_append(tmp, buddy->name); | |
2751 } | |
4359 | 2752 } |
2753 } | |
2754 } | |
2755 | |
2756 return tmp; | |
2757 } | |
2758 | |
2759 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2760 add_chat_buddy_common(GaimConversation *conv, const char *name, int pos) |
4359 | 2761 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2762 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2763 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2764 GaimConvChat *chat; |
4359 | 2765 GtkTreeIter iter; |
2766 GtkListStore *ls; | |
2767 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2768 chat = GAIM_CONV_CHAT(conv); |
4359 | 2769 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2770 gtkchat = gtkconv->u.chat; | |
2771 | |
2772 ls = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list))); | |
2773 | |
2774 gtk_list_store_append(ls, &iter); | |
2775 gtk_list_store_set(ls, &iter, 0, | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2776 (gaim_conv_chat_is_user_ignored(chat, name) ? "X" : " "), |
4359 | 2777 1, name, -1); |
2778 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), 1, | |
2779 GTK_SORT_ASCENDING); | |
2780 } | |
2781 | |
2782 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2783 tab_complete(GaimConversation *conv) |
4359 | 2784 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2785 GaimGtkConversation *gtkconv; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2786 GaimConvChat *chat; |
4359 | 2787 GtkTextIter cursor, word_start, start_buffer; |
2788 int start; | |
2789 int most_matched = -1; | |
2790 char *entered, *partial = NULL; | |
2791 char *text; | |
2792 GList *matches = NULL; | |
2793 GList *nicks = NULL; | |
2794 | |
2795 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2796 chat = GAIM_CONV_CHAT(conv); |
4359 | 2797 |
2798 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_buffer); | |
2799 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, | |
2800 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
2801 | |
2802 word_start = cursor; | |
2803 | |
2804 /* if there's nothing there just return */ | |
2805 if (!gtk_text_iter_compare(&cursor, &start_buffer)) | |
2806 return; | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2807 |
4359 | 2808 text = gtk_text_buffer_get_text(gtkconv->entry_buffer, &start_buffer, |
2809 &cursor, FALSE); | |
2810 | |
2811 /* if we're at the end of ": " we need to move back 2 spaces */ | |
2812 start = strlen(text) - 1; | |
2813 | |
2814 if (strlen(text) >= 2 && !strncmp(&text[start-1], ": ", 2)) | |
2815 gtk_text_iter_backward_chars(&word_start, 2); | |
2816 | |
2817 /* find the start of the word that we're tabbing */ | |
2818 while (start >= 0 && text[start] != ' ') { | |
2819 gtk_text_iter_backward_char(&word_start); | |
2820 start--; | |
2821 } | |
2822 | |
2823 g_free(text); | |
2824 | |
2825 entered = gtk_text_buffer_get_text(gtkconv->entry_buffer, &word_start, | |
2826 &cursor, FALSE); | |
2827 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
2828 if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/old_tab_complete")) { |
4359 | 2829 if (strlen(entered) >= 2 && |
2830 !strncmp(": ", entered + strlen(entered) - 2, 2)) { | |
2831 | |
2832 entered[strlen(entered) - 2] = 0; | |
2833 } | |
2834 } | |
2835 | |
2836 if (!strlen(entered)) { | |
2837 g_free(entered); | |
2838 return; | |
2839 } | |
2840 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2841 for (nicks = gaim_conv_chat_get_users(chat); |
4359 | 2842 nicks != NULL; |
2843 nicks = nicks->next) { | |
2844 | |
2845 char *nick = nicks->data; | |
2846 /* this checks to see if the current nick could be a completion */ | |
4793 | 2847 if (g_ascii_strncasecmp(nick, entered, strlen(entered))) { |
4621
69f028a6f357
[gaim-migrate @ 4912]
Christian Hammond <chipx86@chipx86.com>
parents:
4608
diff
changeset
|
2848 if (*nick != '+' && *nick != '@' && *nick != '%') |
4359 | 2849 continue; |
2850 | |
4793 | 2851 if (g_ascii_strncasecmp(nick + 1, entered, strlen(entered))) { |
4359 | 2852 if (nick[0] != '@' || nick[1] != '+') |
2853 continue; | |
2854 | |
4793 | 2855 if (g_ascii_strncasecmp(nick + 2, entered, strlen(entered))) |
4359 | 2856 continue; |
2857 else | |
2858 nick += 2; | |
2859 } | |
2860 else | |
2861 nick++; | |
2862 } | |
2863 | |
2864 /* if we're here, it's a possible completion */ | |
2865 | |
2866 /* 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
|
2867 if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/old_tab_complete")) { |
4359 | 2868 gtk_text_buffer_delete(gtkconv->entry_buffer, |
2869 &word_start, &cursor); | |
2870 | |
2871 if (strlen(nick) == strlen(entered)) { | |
2872 nicks = (nicks->next | |
2873 ? nicks->next | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2874 : gaim_conv_chat_get_users(chat)); |
4359 | 2875 |
2876 nick = nicks->data; | |
2877 | |
2878 if (*nick == '@') nick++; | |
4621
69f028a6f357
[gaim-migrate @ 4912]
Christian Hammond <chipx86@chipx86.com>
parents:
4608
diff
changeset
|
2879 if (*nick == '%') nick++; |
4359 | 2880 if (*nick == '+') nick++; |
2881 } | |
2882 | |
2883 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, | |
2884 &start_buffer); | |
2885 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, | |
2886 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
2887 | |
2888 if (!gtk_text_iter_compare(&cursor, &start_buffer)) { | |
2889 char *tmp = g_strdup_printf("%s: ", nick); | |
2890 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, | |
2891 tmp, -1); | |
2892 g_free(tmp); | |
2893 } | |
2894 else | |
2895 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, | |
2896 nick, -1); | |
2897 | |
2898 g_free(entered); | |
2899 | |
2900 return; | |
2901 } | |
2902 | |
2903 /* we're only here if we're doing new style */ | |
2904 if (most_matched == -1) { | |
2905 /* | |
2906 * this will only get called once, since from now | |
2907 * on most_matched is >= 0 | |
2908 */ | |
2909 most_matched = strlen(nick); | |
2910 partial = g_strdup(nick); | |
2911 } | |
2912 else if (most_matched) { | |
4793 | 2913 while (g_ascii_strncasecmp(nick, partial, most_matched)) |
4359 | 2914 most_matched--; |
2915 | |
2916 partial[most_matched] = 0; | |
2917 } | |
2918 | |
2919 matches = g_list_append(matches, nick); | |
2920 } | |
2921 | |
2922 /* we're only here if we're doing new style */ | |
2923 | |
2924 /* if there weren't any matches, return */ | |
2925 if (!matches) { | |
2926 /* if matches isn't set partials won't be either */ | |
2927 g_free(entered); | |
2928 return; | |
2929 } | |
2930 | |
2931 gtk_text_buffer_delete(gtkconv->entry_buffer, &word_start, &cursor); | |
2932 | |
2933 if (!matches->next) { | |
2934 /* there was only one match. fill it in. */ | |
2935 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_buffer); | |
2936 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, | |
2937 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
2938 | |
2939 if (!gtk_text_iter_compare(&cursor, &start_buffer)) { | |
2940 char *tmp = g_strdup_printf("%s: ", (char *)matches->data); | |
2941 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, tmp, -1); | |
2942 g_free(tmp); | |
2943 } | |
2944 else | |
2945 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, | |
2946 matches->data, -1); | |
2947 | |
2948 matches = g_list_remove(matches, matches->data); | |
2949 } | |
2950 else { | |
2951 /* | |
2952 * there were lots of matches, fill in as much as possible | |
2953 * and display all of them | |
2954 */ | |
2955 char *addthis = g_malloc0(1); | |
2956 | |
2957 while (matches) { | |
2958 char *tmp = addthis; | |
2959 addthis = g_strconcat(tmp, matches->data, " ", NULL); | |
2960 g_free(tmp); | |
2961 matches = g_list_remove(matches, matches->data); | |
2962 } | |
2963 | |
6982 | 2964 gaim_conversation_write(conv, NULL, addthis, GAIM_MESSAGE_NO_LOG, |
4359 | 2965 time(NULL)); |
2966 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, partial, -1); | |
2967 g_free(addthis); | |
2968 } | |
2969 | |
2970 g_free(entered); | |
2971 g_free(partial); | |
2972 } | |
2973 | |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2974 static void |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2975 save_convo(GtkWidget *save, GaimConversation *c) |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2976 { |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2977 char buf[BUF_LONG]; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2978 GtkWidget *window; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2979 |
7859 | 2980 window = gtk_file_selection_new(_("Save Conversation")); |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2981 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2982 g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S "%s.log", |
7261 | 2983 gaim_home_dir(), gaim_normalize(c->account, c->name)); |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2984 gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2985 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
|
2986 "gaim_conversation", c); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2987 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(window)->ok_button), |
6038 | 2988 "clicked", G_CALLBACK(do_check_save_convo), window); |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2989 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
|
2990 "clicked", G_CALLBACK(gtk_widget_destroy), (gpointer)window); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2991 gtk_widget_show(window); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2992 } |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2993 |
4359 | 2994 static GtkItemFactoryEntry menu_items[] = |
2995 { | |
2996 /* Conversation menu */ | |
4596 | 2997 { N_("/_Conversation"), NULL, NULL, 0, "<Branch>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2998 |
7887 | 2999 { N_("/Conversation/New Instant _Message..."), "<CTL>M", menu_new_conv_cb, |
7859 | 3000 0, "<StockItem>", GAIM_STOCK_IM }, |
3001 | |
3002 { "/Conversation/sep0", NULL, NULL, 0, "<Separator>" }, | |
3003 | |
7880 | 3004 { N_("/Conversation/_Find..."), NULL, menu_find_cb, 0, "<StockItem>", GTK_STOCK_FIND }, |
7859 | 3005 { N_("/Conversation/View _Log"), NULL, menu_view_log_cb, 0, NULL }, |
4596 | 3006 { N_("/Conversation/_Save As..."), NULL, menu_save_as_cb, 0, |
4359 | 3007 "<StockItem>", GTK_STOCK_SAVE_AS }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3008 |
4359 | 3009 { "/Conversation/sep1", NULL, NULL, 0, "<Separator>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3010 |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
3011 { N_("/Conversation/Add Buddy _Pounce..."), NULL, menu_add_pounce_cb, |
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
3012 0, NULL }, |
7859 | 3013 { N_("/Conversation/_Get Info"), NULL, menu_get_info_cb, 0, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3014 "<StockItem>", GAIM_STOCK_INFO }, |
7859 | 3015 { N_("/Conversation/_Warn..."), NULL, menu_warn_cb, 0, |
3016 "<StockItem>", GAIM_STOCK_WARN }, | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3017 { N_("/Conversation/In_vite..."), NULL, menu_invite_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3018 "<StockItem>", GAIM_STOCK_INVITE }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3019 |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
3020 { "/Conversation/sep2", NULL, NULL, 0, "<Separator>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3021 |
7859 | 3022 { N_("/Conversation/A_lias..."), NULL, menu_alias_cb, 0, |
3023 "<StockItem>", GAIM_STOCK_EDIT }, | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3024 { N_("/Conversation/_Block..."), NULL, menu_block_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3025 "<StockItem>", GAIM_STOCK_BLOCK }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3026 { N_("/Conversation/_Add..."), NULL, menu_add_remove_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3027 "<StockItem>", GTK_STOCK_ADD }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3028 { N_("/Conversation/_Remove..."), NULL, menu_add_remove_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3029 "<StockItem>", GTK_STOCK_REMOVE }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3030 |
7859 | 3031 { "/Conversation/sep3", NULL, NULL, 0, "<Separator>" }, |
3032 | |
3033 { N_("/Conversation/Insert Lin_k..."), NULL, menu_insert_link_cb, 0, | |
3034 "<StockItem>", GAIM_STOCK_LINK }, | |
3035 { N_("/Conversation/Insert Imag_e..."), NULL, menu_insert_image_cb, 0, | |
3036 "<StockItem>", GAIM_STOCK_IMAGE }, | |
3037 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3038 { "/Conversation/sep4", NULL, NULL, 0, "<Separator>" }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3039 |
4596 | 3040 { N_("/Conversation/_Close"), NULL, menu_close_conv_cb, 0, |
4359 | 3041 "<StockItem>", GTK_STOCK_CLOSE }, |
3042 | |
3043 /* Options */ | |
4596 | 3044 { N_("/_Options"), NULL, NULL, 0, "<Branch>" }, |
3045 { N_("/Options/Enable _Logging"), NULL, menu_logging_cb, 0, "<CheckItem>" }, | |
3046 { N_("/Options/Enable _Sounds"), NULL, menu_sounds_cb, 0, "<CheckItem>" }, | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3047 { N_("/Options/Show Formatting _Toolbar"), NULL, menu_toolbar_cb, 0, "<CheckItem>" }, |
4359 | 3048 }; |
3049 | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
3050 static const int menu_item_count = |
4359 | 3051 sizeof(menu_items) / sizeof(*menu_items); |
3052 | |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3053 static char * |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3054 item_factory_translate_func (const char *path, gpointer func_data) |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3055 { |
7386 | 3056 return _((char *)path); |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3057 } |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3058 |
4359 | 3059 static GtkWidget * |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3060 setup_menubar(GaimConvWindow *win) |
4359 | 3061 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3062 GaimGtkWindow *gtkwin; |
5116 | 3063 GtkAccelGroup *accel_group; |
4359 | 3064 gtkwin = GAIM_GTK_WINDOW(win); |
3065 | |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
3066 accel_group = gtk_accel_group_new (); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
3067 gtk_window_add_accel_group (GTK_WINDOW (gtkwin->window), accel_group); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
3068 g_object_unref (accel_group); |
5116 | 3069 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3070 gtkwin->menu.item_factory = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3071 gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<main>", accel_group); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3072 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3073 gtk_item_factory_set_translate_func(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3074 item_factory_translate_func, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3075 NULL, NULL); |
4630 | 3076 |
3077 gtk_item_factory_create_items(gtkwin->menu.item_factory, menu_item_count, | |
4359 | 3078 menu_items, win); |
7420 | 3079 g_signal_connect(G_OBJECT(accel_group), "accel-changed", |
3080 G_CALLBACK(gaim_gtk_save_accels_cb), NULL); | |
4359 | 3081 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3082 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3083 gtkwin->menu.menubar = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3084 gtk_item_factory_get_widget(gtkwin->menu.item_factory, "<main>"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3085 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3086 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3087 gtkwin->menu.view_log = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3088 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
7295 | 3089 N_("/Conversation/View Log")); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3090 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3091 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3092 gtkwin->menu.add_pounce = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3093 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3094 N_("/Conversation/Add Buddy Pounce...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3095 |
7879 | 3096 /* --- */ |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3097 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3098 gtkwin->menu.get_info = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3099 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
7859 | 3100 N_("/Conversation/Get Info")); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3101 |
7879 | 3102 gtkwin->menu.warn = |
3103 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3104 N_("/Conversation/Warn...")); | |
3105 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3106 gtkwin->menu.invite = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3107 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3108 N_("/Conversation/Invite...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3109 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3110 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3111 |
7879 | 3112 gtkwin->menu.alias = |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3113 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
7879 | 3114 N_("/Conversation/Alias...")); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3115 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3116 gtkwin->menu.block = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3117 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3118 N_("/Conversation/Block...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3119 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3120 gtkwin->menu.add = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3121 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3122 N_("/Conversation/Add...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3123 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3124 gtkwin->menu.remove = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3125 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3126 N_("/Conversation/Remove...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3127 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3128 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3129 |
7879 | 3130 gtkwin->menu.insert_link = |
3131 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3132 N_("/Conversation/Insert Link...")); | |
3133 | |
3134 gtkwin->menu.insert_image = | |
3135 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3136 N_("/Conversation/Insert Image...")); | |
3137 | |
3138 /* --- */ | |
3139 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3140 gtkwin->menu.logging = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3141 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3142 N_("/Options/Enable Logging")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3143 gtkwin->menu.sounds = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3144 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3145 N_("/Options/Enable Sounds")); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3146 gtkwin->menu.show_formatting_toolbar = |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3147 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3148 N_("/Options/Show Formatting Toolbar")); |
4359 | 3149 |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3150 generate_send_as_items(win, NULL); |
4359 | 3151 |
3152 gtk_widget_show(gtkwin->menu.menubar); | |
4931 | 3153 |
3154 return gtkwin->menu.menubar; | |
4359 | 3155 } |
3156 | |
3157 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3158 setup_im_buttons(GaimConversation *conv, GtkWidget *parent) |
4359 | 3159 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3160 GaimConnection *gc; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3161 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3162 GaimGtkImPane *gtkim; |
4359 | 3163 GaimConversationType type = GAIM_CONV_IM; |
3164 | |
3165 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3166 gtkim = gtkconv->u.im; | |
3167 gc = gaim_conversation_get_gc(conv); | |
3168 | |
3169 /* From right to left... */ | |
3170 | |
3171 /* Send button */ | |
3172 gtkconv->send = gaim_gtk_change_text(_("Send"), gtkconv->send, | |
3173 GAIM_STOCK_SEND, type); | |
3174 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->send, _("Send"), NULL); | |
3175 gtk_box_pack_end(GTK_BOX(parent), gtkconv->send, FALSE, FALSE, 0); | |
3176 | |
3177 /* Separator */ | |
3178 if (gtkim->sep2 != NULL) | |
3179 gtk_widget_destroy(gtkim->sep2); | |
3180 | |
3181 gtkim->sep2 = gtk_vseparator_new(); | |
3182 gtk_box_pack_end(GTK_BOX(parent), gtkim->sep2, FALSE, TRUE, 0); | |
3183 gtk_widget_show(gtkim->sep2); | |
3184 | |
3185 /* Now, um, just kind of all over the place. Huh? */ | |
3186 | |
3187 /* Warn button */ | |
3188 gtkim->warn = gaim_gtk_change_text(_("Warn"), gtkim->warn, | |
3189 GAIM_STOCK_WARN, type); | |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3190 gtk_tooltips_set_tip(gtkconv->tooltips, gtkim->warn, |
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3191 _("Warn the user"), NULL); |
7929 | 3192 gtk_box_pack_start(GTK_BOX(parent), gtkim->warn, FALSE, FALSE, 0); |
3193 | |
3194 /* Block button */ | |
3195 gtkim->block = gaim_gtk_change_text(_("Block"), gtkim->block, | |
3196 GAIM_STOCK_BLOCK, type); | |
3197 gtk_tooltips_set_tip(gtkconv->tooltips, gtkim->block, | |
3198 _("Block the user"), NULL); | |
3199 gtk_box_pack_start(GTK_BOX(parent), gtkim->block, FALSE, FALSE, 0); | |
3200 | |
3201 /* Add button */ | |
3202 gtkconv->add = gaim_gtk_change_text(_("Add"), gtkconv->add, | |
3203 GTK_STOCK_ADD, type); | |
3204 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->add, | |
3205 _("Add the user to your buddy list"), NULL); | |
3206 gtk_box_pack_start(GTK_BOX(parent), gtkconv->add, FALSE, FALSE, 0); | |
3207 | |
3208 /* Remove button */ | |
3209 gtkconv->remove = gaim_gtk_change_text(_("Remove"), gtkconv->remove, | |
3210 GTK_STOCK_REMOVE, type); | |
3211 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->remove, | |
3212 _("Remove the user from your buddy list"), NULL); | |
3213 gtk_box_pack_start(GTK_BOX(parent), gtkconv->remove, FALSE, FALSE, 0); | |
4359 | 3214 |
3215 /* Info button */ | |
3216 gtkconv->info = gaim_gtk_change_text(_("Info"), gtkconv->info, | |
3217 GAIM_STOCK_INFO, type); | |
3218 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->info, | |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3219 _("Get the user's information"), NULL); |
7929 | 3220 gtk_box_pack_start(GTK_BOX(parent), gtkconv->info, FALSE, FALSE, 0); |
3221 | |
3222 gtk_button_set_relief(GTK_BUTTON(gtkim->warn), GTK_RELIEF_NONE); | |
3223 gtk_button_set_relief(GTK_BUTTON(gtkim->block), GTK_RELIEF_NONE); | |
3224 gtk_button_set_relief(GTK_BUTTON(gtkconv->add), GTK_RELIEF_NONE); | |
3225 gtk_button_set_relief(GTK_BUTTON(gtkconv->remove), GTK_RELIEF_NONE); | |
4359 | 3226 gtk_button_set_relief(GTK_BUTTON(gtkconv->info), GTK_RELIEF_NONE); |
3227 gtk_button_set_relief(GTK_BUTTON(gtkconv->send), GTK_RELIEF_NONE); | |
7929 | 3228 |
3229 gtk_size_group_add_widget(gtkconv->sg, gtkim->warn); | |
3230 gtk_size_group_add_widget(gtkconv->sg, gtkim->block); | |
3231 gtk_size_group_add_widget(gtkconv->sg, gtkconv->add); | |
3232 gtk_size_group_add_widget(gtkconv->sg, gtkconv->remove); | |
4359 | 3233 gtk_size_group_add_widget(gtkconv->sg, gtkconv->info); |
3234 gtk_size_group_add_widget(gtkconv->sg, gtkconv->send); | |
7929 | 3235 |
3236 gtk_box_reorder_child(GTK_BOX(parent), gtkim->warn, 1); | |
3237 gtk_box_reorder_child(GTK_BOX(parent), gtkim->block, 2); | |
3238 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->add, 3); | |
3239 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->remove, 4); | |
3240 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->info, 5); | |
4359 | 3241 |
3242 gaim_gtkconv_update_buttons_by_protocol(conv); | |
3243 | |
3244 g_signal_connect(G_OBJECT(gtkim->warn), "clicked", | |
3245 G_CALLBACK(warn_cb), conv); | |
3246 g_signal_connect(G_OBJECT(gtkim->block), "clicked", | |
3247 G_CALLBACK(block_cb), conv); | |
7929 | 3248 g_signal_connect(G_OBJECT(gtkconv->add), "clicked", |
3249 G_CALLBACK(add_remove_cb), conv); | |
3250 g_signal_connect(G_OBJECT(gtkconv->remove), "clicked", | |
3251 G_CALLBACK(add_remove_cb), conv); | |
3252 g_signal_connect(G_OBJECT(gtkconv->info), "clicked", | |
3253 G_CALLBACK(info_cb), conv); | |
3254 g_signal_connect(G_OBJECT(gtkconv->send), "clicked", | |
3255 G_CALLBACK(send_cb), conv); | |
4359 | 3256 } |
3257 | |
3258 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3259 setup_chat_buttons(GaimConversation *conv, GtkWidget *parent) |
4359 | 3260 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3261 GaimConnection *gc; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3262 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3263 GaimGtkChatPane *gtkchat; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3264 GaimGtkWindow *gtkwin; |
4359 | 3265 GtkWidget *sep; |
3266 | |
3267 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3268 gtkchat = gtkconv->u.chat; | |
3269 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); | |
3270 gc = gaim_conversation_get_gc(conv); | |
3271 | |
3272 /* Send button */ | |
3273 gtkconv->send = gaim_gtk_change_text(_("Send"), gtkconv->send, | |
3274 GAIM_STOCK_SEND, GAIM_CONV_CHAT); | |
3275 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->send, _("Send"), NULL); | |
3276 gtk_box_pack_end(GTK_BOX(parent), gtkconv->send, FALSE, FALSE, 0); | |
3277 | |
3278 /* Separator */ | |
3279 sep = gtk_vseparator_new(); | |
3280 gtk_box_pack_end(GTK_BOX(parent), sep, FALSE, TRUE, 0); | |
3281 gtk_widget_show(sep); | |
3282 | |
3283 /* Invite */ | |
3284 gtkchat->invite = gaim_gtk_change_text(_("Invite"), gtkchat->invite, | |
3285 GAIM_STOCK_INVITE, GAIM_CONV_CHAT); | |
3286 gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->invite, | |
3287 _("Invite a user"), NULL); | |
7931 | 3288 gtk_box_pack_start(GTK_BOX(parent), gtkchat->invite, FALSE, FALSE, 0); |
4359 | 3289 |
7929 | 3290 /* Add button */ |
3291 gtkconv->add = gaim_gtk_change_text(_("Add"), gtkconv->add, | |
3292 GTK_STOCK_ADD, GAIM_CONV_CHAT); | |
3293 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->add, | |
3294 _("Add the chat to your buddy list"), NULL); | |
3295 gtk_box_pack_start(GTK_BOX(parent), gtkconv->add, FALSE, FALSE, 0); | |
3296 | |
3297 /* Remove button */ | |
3298 gtkconv->remove = gaim_gtk_change_text(_("Remove"), gtkconv->remove, | |
3299 GTK_STOCK_REMOVE, GAIM_CONV_CHAT); | |
3300 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->remove, | |
3301 _("Remove the chat from your buddy list"), NULL); | |
3302 gtk_box_pack_start(GTK_BOX(parent), gtkconv->remove, FALSE, FALSE, 0); | |
3303 | |
4359 | 3304 /* Set the relief on these. */ |
3305 gtk_button_set_relief(GTK_BUTTON(gtkchat->invite), GTK_RELIEF_NONE); | |
7929 | 3306 gtk_button_set_relief(GTK_BUTTON(gtkconv->add), GTK_RELIEF_NONE); |
3307 gtk_button_set_relief(GTK_BUTTON(gtkconv->remove), GTK_RELIEF_NONE); | |
4359 | 3308 gtk_button_set_relief(GTK_BUTTON(gtkconv->send), GTK_RELIEF_NONE); |
3309 | |
3310 /* Callbacks */ | |
7929 | 3311 g_signal_connect(G_OBJECT(gtkchat->invite), "clicked", |
3312 G_CALLBACK(invite_cb), conv); | |
3313 g_signal_connect(G_OBJECT(gtkconv->add), "clicked", | |
3314 G_CALLBACK(add_remove_cb), conv); | |
3315 g_signal_connect(G_OBJECT(gtkconv->remove), "clicked", | |
3316 G_CALLBACK(add_remove_cb), conv); | |
4359 | 3317 g_signal_connect(G_OBJECT(gtkconv->send), "clicked", |
3318 G_CALLBACK(send_cb), conv); | |
3319 } | |
3320 | |
3321 static GtkWidget * | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3322 build_conv_toolbar(GaimConversation *conv) |
4359 | 3323 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3324 GaimGtkConversation *gtkconv; |
4359 | 3325 GtkWidget *vbox; |
3326 GtkWidget *hbox; | |
3327 GtkWidget *button; | |
3328 GtkWidget *sep; | |
3329 GtkSizeGroup *sg; | |
3330 | |
3331 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3332 | |
3333 sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); | |
3334 | |
3335 vbox = gtk_vbox_new(FALSE, 0); | |
3336 sep = gtk_hseparator_new(); | |
3337 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); | |
3338 | |
3339 hbox = gtk_hbox_new(FALSE, 5); | |
3340 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
3341 | |
3342 /* Bold */ | |
3343 button = gaim_pixbuf_toolbar_button_from_stock(GTK_STOCK_BOLD); | |
3344 gtk_size_group_add_widget(sg, button); | |
3345 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3346 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("Bold"), NULL); | |
3347 | |
3348 g_signal_connect(G_OBJECT(button), "clicked", | |
3349 G_CALLBACK(do_bold), gtkconv); | |
3350 | |
3351 gtkconv->toolbar.bold = button; | |
3352 | |
3353 /* Italic */ | |
3354 button = gaim_pixbuf_toolbar_button_from_stock(GTK_STOCK_ITALIC); | |
3355 gtk_size_group_add_widget(sg, button); | |
3356 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3357 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("Italic"), NULL); | |
3358 | |
3359 g_signal_connect(G_OBJECT(button), "clicked", | |
3360 G_CALLBACK(do_italic), gtkconv); | |
3361 | |
3362 gtkconv->toolbar.italic = button; | |
3363 | |
3364 /* Underline */ | |
3365 button = gaim_pixbuf_toolbar_button_from_stock(GTK_STOCK_UNDERLINE); | |
3366 gtk_size_group_add_widget(sg, button); | |
3367 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3368 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("Underline"), NULL); | |
3369 | |
3370 g_signal_connect(G_OBJECT(button), "clicked", | |
3371 G_CALLBACK(do_underline), gtkconv); | |
3372 | |
3373 gtkconv->toolbar.underline = button; | |
3374 | |
3375 /* Sep */ | |
3376 sep = gtk_vseparator_new(); | |
3377 gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 0); | |
3378 | |
3379 /* Increase font size */ | |
3380 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_TEXT_BIGGER); | |
3381 gtk_size_group_add_widget(sg, button); | |
3382 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3383 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
3384 _("Larger font size"), NULL); | |
3385 | |
3386 g_signal_connect(G_OBJECT(button), "clicked", | |
3387 G_CALLBACK(do_big), gtkconv); | |
3388 | |
5049 | 3389 gtkconv->toolbar.larger_size = button; |
3390 | |
7740 | 3391 /* Normal font size |
4359 | 3392 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_TEXT_NORMAL); |
3393 gtk_size_group_add_widget(sg, button); | |
3394 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3395 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
3396 _("Normal font size"), NULL); | |
3397 | |
3398 g_signal_connect(G_OBJECT(button), "clicked", | |
3399 G_CALLBACK(do_normal), gtkconv); | |
3400 | |
3401 gtkconv->toolbar.normal_size = button; | |
7740 | 3402 */ |
4359 | 3403 |
3404 /* Decrease font size */ | |
3405 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_TEXT_SMALLER); | |
3406 gtk_size_group_add_widget(sg, button); | |
3407 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3408 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
3409 _("Smaller font size"), NULL); | |
3410 | |
3411 g_signal_connect(G_OBJECT(button), "clicked", | |
3412 G_CALLBACK(do_small), gtkconv); | |
3413 | |
5049 | 3414 gtkconv->toolbar.smaller_size = button; |
3415 | |
4359 | 3416 /* Sep */ |
3417 sep = gtk_vseparator_new(); | |
3418 gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 0); | |
3419 | |
4685 | 3420 /* Font Face */ |
3421 | |
3422 button = gaim_pixbuf_toolbar_button_from_stock(GTK_STOCK_SELECT_FONT); | |
3423 gtk_size_group_add_widget(sg, button); | |
3424 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3425 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
3426 _("Font Face"), NULL); | |
3427 | |
3428 g_signal_connect(G_OBJECT(button), "clicked", | |
3429 G_CALLBACK(toggle_font), conv); | |
3430 | |
3431 gtkconv->toolbar.font = button; | |
3432 | |
4359 | 3433 /* Foreground Color */ |
3434 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_FGCOLOR); | |
3435 gtk_size_group_add_widget(sg, button); | |
3436 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3437 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
3438 _("Foreground font color"), NULL); | |
3439 | |
3440 g_signal_connect(G_OBJECT(button), "clicked", | |
3441 G_CALLBACK(toggle_fg_color), conv); | |
3442 | |
3443 gtkconv->toolbar.fgcolor = button; | |
3444 | |
3445 /* Background Color */ | |
3446 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_BGCOLOR); | |
3447 gtk_size_group_add_widget(sg, button); | |
3448 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3449 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
3450 _("Background color"), NULL); | |
3451 | |
3452 g_signal_connect(G_OBJECT(button), "clicked", | |
3453 G_CALLBACK(toggle_bg_color), conv); | |
3454 | |
3455 gtkconv->toolbar.bgcolor = button; | |
3456 | |
3457 /* Sep */ | |
3458 sep = gtk_vseparator_new(); | |
3459 gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 0); | |
3460 | |
7927 | 3461 /* Insert Link */ |
3462 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_LINK); | |
3463 gtk_size_group_add_widget(sg, button); | |
3464 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3465 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("Insert link"), NULL); | |
3466 | |
3467 g_signal_connect(G_OBJECT(button), "clicked", | |
3468 G_CALLBACK(insert_link_cb), conv); | |
3469 | |
3470 gtkconv->toolbar.link = button; | |
3471 | |
4359 | 3472 /* Insert IM Image */ |
3473 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_IMAGE); | |
3474 gtk_size_group_add_widget(sg, button); | |
3475 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3476 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("Insert image"), NULL); | |
3477 | |
3478 g_signal_connect(G_OBJECT(button), "clicked", | |
3479 G_CALLBACK(insert_image_cb), conv); | |
3480 | |
3481 gtkconv->toolbar.image = button; | |
3482 | |
3483 /* Insert Smiley */ | |
3484 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_SMILEY); | |
3485 gtk_size_group_add_widget(sg, button); | |
3486 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3487 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("Insert smiley"), NULL); | |
3488 | |
3489 g_signal_connect(G_OBJECT(button), "clicked", | |
3490 G_CALLBACK(insert_smiley_cb), conv); | |
3491 | |
3492 gtkconv->toolbar.smiley = button; | |
3493 | |
3494 | |
3495 sep = gtk_hseparator_new(); | |
3496 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); | |
3497 | |
3498 gtk_widget_show_all(vbox); | |
3499 | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3500 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/show_formatting_toolbar")) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3501 gtk_widget_hide(vbox); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3502 |
4359 | 3503 return vbox; |
3504 } | |
3505 | |
3506 static GtkWidget * | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3507 setup_chat_pane(GaimConversation *conv) |
4359 | 3508 { |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3509 GaimPluginProtocolInfo *prpl_info = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3510 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3511 GaimGtkChatPane *gtkchat; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3512 GaimConnection *gc; |
4359 | 3513 GtkWidget *vpaned, *hpaned; |
3514 GtkWidget *vbox, *hbox; | |
3515 GtkWidget *lbox, *bbox; | |
3516 GtkWidget *label; | |
3517 GtkWidget *list; | |
3518 GtkWidget *button; | |
7949 | 3519 GtkWidget *sw; |
4359 | 3520 GtkListStore *ls; |
3521 GtkCellRenderer *rend; | |
3522 GtkTreeViewColumn *col; | |
3523 | |
3524 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3525 gtkchat = gtkconv->u.chat; | |
3526 gc = gaim_conversation_get_gc(conv); | |
3527 | |
3528 /* Setup the outer pane. */ | |
3529 vpaned = gtk_vpaned_new(); | |
3530 gtk_widget_show(vpaned); | |
3531 | |
3532 /* Setup the top part of the pane. */ | |
3533 vbox = gtk_vbox_new(FALSE, 5); | |
3534 gtk_paned_pack1(GTK_PANED(vpaned), vbox, TRUE, FALSE); | |
3535 gtk_widget_show(vbox); | |
3536 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3537 if (gc != NULL) |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3538 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3539 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3540 if (prpl_info->options & OPT_PROTO_CHAT_TOPIC) |
4359 | 3541 { |
3542 hbox = gtk_hbox_new(FALSE, 0); | |
3543 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
3544 gtk_widget_show(hbox); | |
3545 | |
3546 label = gtk_label_new(_("Topic:")); | |
3547 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
3548 gtk_widget_show(label); | |
3549 | |
3550 gtkchat->topic_text = gtk_entry_new(); | |
4635 | 3551 gtk_editable_set_editable(GTK_EDITABLE(gtkchat->topic_text), FALSE); |
4359 | 3552 gtk_box_pack_start(GTK_BOX(hbox), gtkchat->topic_text, TRUE, TRUE, 5); |
3553 gtk_widget_show(gtkchat->topic_text); | |
3554 } | |
3555 | |
3556 /* Setup the horizontal pane. */ | |
3557 hpaned = gtk_hpaned_new(); | |
3558 gtk_box_pack_start(GTK_BOX(vbox), hpaned, TRUE, TRUE, 5); | |
3559 gtk_widget_show(hpaned); | |
3560 | |
3561 /* Setup the scrolled window to put gtkimhtml in. */ | |
3562 gtkconv->sw = gtk_scrolled_window_new(NULL, NULL); | |
3563 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
3564 GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); | |
3565 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
3566 GTK_SHADOW_IN); | |
3567 gtk_paned_pack1(GTK_PANED(hpaned), gtkconv->sw, TRUE, TRUE); | |
3568 | |
3569 gtk_widget_set_size_request(gtkconv->sw, | |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3570 gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_width"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3571 gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_height")); |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3572 |
4359 | 3573 gtk_widget_show(gtkconv->sw); |
3574 | |
3575 /* Setup gtkihmtml. */ | |
3576 gtkconv->imhtml = gtk_imhtml_new(NULL, NULL); | |
3577 gtk_container_add(GTK_CONTAINER(gtkconv->sw), gtkconv->imhtml); | |
3578 | |
3579 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3580 gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); |
4359 | 3581 |
3582 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", | |
3583 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
6057 | 3584 g_signal_connect(G_OBJECT(gtkconv->imhtml), "button_release_event", |
3585 G_CALLBACK(refocus_entry_cb), gtkconv); | |
4359 | 3586 |
3587 gaim_setup_imhtml(gtkconv->imhtml); | |
3588 | |
3589 gtk_widget_show(gtkconv->imhtml); | |
3590 | |
3591 /* Build the right pane. */ | |
3592 lbox = gtk_vbox_new(FALSE, 5); | |
4409
0521eec12c33
[gaim-migrate @ 4682]
Christian Hammond <chipx86@chipx86.com>
parents:
4398
diff
changeset
|
3593 gtk_paned_pack2(GTK_PANED(hpaned), lbox, FALSE, TRUE); |
4359 | 3594 gtk_widget_show(lbox); |
3595 | |
3596 /* Setup the label telling how many people are in the room. */ | |
3597 gtkchat->count = gtk_label_new(_("0 people in room")); | |
3598 gtk_box_pack_start(GTK_BOX(lbox), gtkchat->count, FALSE, FALSE, 0); | |
3599 gtk_widget_show(gtkchat->count); | |
3600 | |
3601 /* Setup the list of users. */ | |
7949 | 3602 sw = gtk_scrolled_window_new(NULL, NULL); |
3603 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
4359 | 3604 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); |
7949 | 3605 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); |
3606 gtk_box_pack_start(GTK_BOX(lbox), sw, TRUE, TRUE, 0); | |
3607 gtk_widget_show(sw); | |
4359 | 3608 |
3609 ls = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING); | |
3610 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), 1, | |
3611 GTK_SORT_ASCENDING); | |
3612 | |
3613 list = gtk_tree_view_new_with_model(GTK_TREE_MODEL(ls)); | |
3614 | |
3615 rend = gtk_cell_renderer_text_new(); | |
3616 col = gtk_tree_view_column_new_with_attributes(NULL, rend, | |
3617 "text", 0, NULL); | |
3618 gtk_tree_view_column_set_clickable(GTK_TREE_VIEW_COLUMN(col), TRUE); | |
3619 | |
3620 g_signal_connect(G_OBJECT(list), "button_press_event", | |
3621 G_CALLBACK(right_click_chat_cb), conv); | |
3622 | |
3623 gtk_tree_view_append_column(GTK_TREE_VIEW(list), col); | |
3624 | |
3625 col = gtk_tree_view_column_new_with_attributes(NULL, rend, | |
3626 "text", 1, NULL); | |
3627 gtk_tree_view_column_set_clickable(GTK_TREE_VIEW_COLUMN(col), TRUE); | |
3628 | |
3629 gtk_tree_view_append_column(GTK_TREE_VIEW(list), col); | |
3630 | |
3631 gtk_widget_set_size_request(list, 150, -1); | |
3632 | |
3633 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(list), FALSE); | |
3634 gtk_widget_show(list); | |
3635 | |
3636 gtkchat->list = list; | |
3637 | |
7949 | 3638 gtk_container_add(GTK_CONTAINER(sw), list); |
4359 | 3639 |
3640 /* Setup the user list toolbar. */ | |
3641 bbox = gtk_hbox_new(TRUE, 5); | |
3642 gtk_box_pack_start(GTK_BOX(lbox), bbox, FALSE, FALSE, 0); | |
3643 gtk_widget_show(bbox); | |
3644 | |
3645 /* IM */ | |
3646 button = gaim_pixbuf_button_from_stock(NULL, GTK_STOCK_REDO, | |
3647 GAIM_BUTTON_VERTICAL); | |
3648 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
3649 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
|
3650 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("IM the user"), NULL); |
4359 | 3651 g_signal_connect(G_OBJECT(button), "clicked", |
3652 G_CALLBACK(im_cb), conv); | |
3653 | |
3654 gtk_widget_show(button); | |
3655 | |
3656 /* Ignore */ | |
3657 button = gaim_pixbuf_button_from_stock(NULL, GAIM_STOCK_IGNORE, | |
3658 GAIM_BUTTON_VERTICAL); | |
3659 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
3660 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
|
3661 gtk_tooltips_set_tip(gtkconv->tooltips, button, |
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3662 _("Ignore the user"), NULL); |
4359 | 3663 g_signal_connect(G_OBJECT(button), "clicked", |
3664 G_CALLBACK(ignore_cb), conv); | |
3665 gtk_widget_show(button); | |
3666 | |
3667 /* Info */ | |
3668 button = gaim_pixbuf_button_from_stock(NULL, GAIM_STOCK_INFO, | |
3669 GAIM_BUTTON_VERTICAL); | |
3670 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
3671 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
3672 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3673 _("Get the user's information"), NULL); |
4359 | 3674 g_signal_connect(G_OBJECT(button), "clicked", |
3675 G_CALLBACK(info_cb), conv); | |
3676 | |
3677 gtk_widget_show(button); | |
3678 | |
3679 gtkconv->info = button; | |
3680 | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3681 /* Build the toolbar. */ |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3682 vbox = gtk_vbox_new(FALSE, 5); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3683 gtk_paned_pack2(GTK_PANED(vpaned), vbox, FALSE, FALSE); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3684 gtk_widget_show(vbox); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3685 |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3686 gtkconv->toolbar.toolbar = build_conv_toolbar(conv); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3687 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->toolbar.toolbar, |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3688 FALSE, FALSE, 0); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3689 |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3690 /* Setup the entry widget. */ |
7949 | 3691 sw = gtk_scrolled_window_new(NULL, NULL); |
3692 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
3693 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); | |
3694 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), | |
3695 GTK_SHADOW_IN); | |
3696 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); | |
3697 gtk_widget_show(sw); | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3698 |
7700 | 3699 gtkconv->entry = gtk_imhtml_new(NULL, NULL); |
3700 gtkconv->entry_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); | |
7949 | 3701 gaim_setup_imhtml(gtkconv->entry); |
7700 | 3702 gtk_imhtml_set_editable(GTK_IMHTML(gtkconv->entry), TRUE); |
7766 | 3703 default_formatize(conv); |
5105 | 3704 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
|
3705 gtk_widget_set_size_request(gtkconv->entry, -1, |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3706 MAX(gaim_prefs_get_int("/gaim/gtk/conversations/chat/entry_height"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3707 25)); |
7949 | 3708 g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", conv); |
3709 | |
4359 | 3710 g_signal_connect_swapped(G_OBJECT(gtkconv->entry), "key_press_event", |
3711 G_CALLBACK(entry_key_pressed_cb_1), | |
3712 gtkconv->entry_buffer); | |
7949 | 3713 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", |
3714 G_CALLBACK(entry_key_pressed_cb_2), conv); | |
4359 | 3715 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", |
3716 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
3717 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3718 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
3719 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
4359 | 3720 |
7949 | 3721 gtk_container_add(GTK_CONTAINER(sw), GTK_WIDGET(gtkconv->entry)); |
4359 | 3722 gtk_widget_show(gtkconv->entry); |
3723 | |
3724 /* Setup the bottom button box. */ | |
3725 gtkconv->bbox = gtk_hbox_new(FALSE, 5); | |
3726 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->bbox, FALSE, FALSE, 0); | |
3727 gtk_widget_show(gtkconv->bbox); | |
3728 | |
3729 setup_chat_buttons(conv, gtkconv->bbox); | |
3730 | |
3731 return vpaned; | |
3732 } | |
3733 | |
3734 static GtkWidget * | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3735 setup_im_pane(GaimConversation *conv) |
4359 | 3736 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3737 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3738 GaimGtkImPane *gtkim; |
4359 | 3739 GtkWidget *paned; |
3740 GtkWidget *vbox; | |
3741 GtkWidget *vbox2; | |
7949 | 3742 GtkWidget *sw; |
4359 | 3743 |
3744 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3745 gtkim = gtkconv->u.im; | |
3746 | |
3747 /* Setup the outer pane. */ | |
3748 paned = gtk_vpaned_new(); | |
3749 gtk_widget_show(paned); | |
3750 | |
3751 /* Setup the top part of the pane. */ | |
3752 vbox = gtk_vbox_new(FALSE, 5); | |
4409
0521eec12c33
[gaim-migrate @ 4682]
Christian Hammond <chipx86@chipx86.com>
parents:
4398
diff
changeset
|
3753 gtk_paned_pack1(GTK_PANED(paned), vbox, TRUE, TRUE); |
4359 | 3754 gtk_widget_show(vbox); |
3755 | |
3756 /* Setup the gtkimhtml widget. */ | |
3757 gtkconv->sw = gtk_scrolled_window_new(NULL, NULL); | |
3758 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
3759 GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); | |
3760 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
3761 GTK_SHADOW_IN); | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3762 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->sw, TRUE, TRUE, 0); |
4851 | 3763 |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3764 gtk_widget_set_size_request(gtkconv->sw, |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3765 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_width"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3766 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_height")); |
4359 | 3767 gtk_widget_show(gtkconv->sw); |
3768 | |
3769 gtkconv->imhtml = gtk_imhtml_new(NULL, NULL); | |
3770 gtk_container_add(GTK_CONTAINER(gtkconv->sw), gtkconv->imhtml); | |
3771 | |
3772 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", | |
3773 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
6057 | 3774 g_signal_connect(G_OBJECT(gtkconv->imhtml), "button_release_event", |
3775 G_CALLBACK(refocus_entry_cb), gtkconv); | |
4359 | 3776 |
3777 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3778 gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); |
4359 | 3779 |
3780 gaim_setup_imhtml(gtkconv->imhtml); | |
3781 gtk_widget_show(gtkconv->imhtml); | |
3782 | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3783 vbox2 = gtk_vbox_new(FALSE, 5); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3784 gtk_paned_pack2(GTK_PANED(paned), vbox2, FALSE, FALSE); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3785 gtk_widget_show(vbox2); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3786 |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3787 /* Build the toolbar. */ |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3788 gtkconv->toolbar.toolbar = build_conv_toolbar(conv); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3789 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->toolbar.toolbar, |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3790 FALSE, FALSE, 0); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3791 |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3792 /* Setup the entry widget. */ |
7949 | 3793 sw = gtk_scrolled_window_new(NULL, NULL); |
3794 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
3795 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); | |
3796 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), | |
3797 GTK_SHADOW_IN); | |
3798 gtk_box_pack_start(GTK_BOX(vbox2), sw, TRUE, TRUE, 0); | |
3799 gtk_widget_show(sw); | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3800 |
7695 | 3801 gtkconv->entry = gtk_imhtml_new(NULL, NULL); |
7949 | 3802 gtkconv->entry_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); |
3803 gaim_setup_imhtml(gtkconv->entry); | |
7695 | 3804 gtk_imhtml_set_editable(GTK_IMHTML(gtkconv->entry), TRUE); |
7766 | 3805 default_formatize(conv); |
5105 | 3806 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
|
3807 gtk_widget_set_size_request(gtkconv->entry, -1, |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3808 MAX(gaim_prefs_get_int("/gaim/gtk/conversations/im/entry_height"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3809 25)); |
7949 | 3810 g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", conv); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3811 |
4359 | 3812 g_signal_connect_swapped(G_OBJECT(gtkconv->entry), "key_press_event", |
3813 G_CALLBACK(entry_key_pressed_cb_1), | |
3814 gtkconv->entry_buffer); | |
3815 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", | |
3816 G_CALLBACK(entry_key_pressed_cb_2), conv); | |
3817 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", | |
3818 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
3819 | |
3820 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "insert_text", | |
3821 G_CALLBACK(insert_text_cb), conv); | |
3822 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "delete_range", | |
3823 G_CALLBACK(delete_text_cb), conv); | |
3824 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3825 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
3826 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
4359 | 3827 |
7949 | 3828 gtk_container_add(GTK_CONTAINER(sw), GTK_WIDGET(gtkconv->entry)); |
4359 | 3829 gtk_widget_show(gtkconv->entry); |
3830 | |
3831 gtkconv->bbox = gtk_hbox_new(FALSE, 5); | |
3832 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->bbox, FALSE, FALSE, 0); | |
3833 gtk_widget_show(gtkconv->bbox); | |
3834 | |
3835 setup_im_buttons(conv, gtkconv->bbox); | |
3836 | |
3837 return paned; | |
3838 } | |
3839 | |
3840 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3841 move_next_tab(GaimConversation *conv) |
4359 | 3842 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3843 GaimConversation *next_conv = NULL; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3844 GaimConvWindow *win; |
4359 | 3845 GList *l; |
3846 int index, i; | |
3847 | |
3848 win = gaim_conversation_get_window(conv); | |
3849 index = gaim_conversation_get_index(conv); | |
3850 | |
3851 /* First check the tabs after this position. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3852 for (l = g_list_nth(gaim_conv_window_get_conversations(win), index); |
4359 | 3853 l != NULL; |
3854 l = l->next) { | |
3855 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3856 next_conv = (GaimConversation *)l->data; |
4359 | 3857 |
3858 if (gaim_conversation_get_unseen(next_conv) > 0) | |
3859 break; | |
3860 | |
3861 next_conv = NULL; | |
3862 } | |
3863 | |
3864 if (next_conv == NULL) { | |
3865 | |
3866 /* Now check before this position. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3867 for (l = gaim_conv_window_get_conversations(win), i = 0; |
4359 | 3868 l != NULL && i < index; |
3869 l = l->next) { | |
3870 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3871 next_conv = (GaimConversation *)l->data; |
4359 | 3872 |
3873 if (gaim_conversation_get_unseen(next_conv) > 0) | |
3874 break; | |
3875 | |
3876 next_conv = NULL; | |
3877 } | |
3878 | |
3879 if (next_conv == NULL) { | |
3880 /* Okay, just grab the next conversation tab. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3881 if (index == gaim_conv_window_get_conversation_count(win) - 1) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3882 next_conv = gaim_conv_window_get_conversation_at(win, 0); |
4359 | 3883 else |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3884 next_conv = gaim_conv_window_get_conversation_at(win, index + 1); |
4359 | 3885 } |
3886 } | |
3887 | |
3888 if (next_conv != NULL && next_conv != conv) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3889 gaim_conv_window_switch_conversation(win, |
4359 | 3890 gaim_conversation_get_index(next_conv)); |
3891 } | |
3892 } | |
3893 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3894 static void |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3895 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
|
3896 GtkSelectionData *sd, guint info, guint t, |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3897 GaimConversation *conv) |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3898 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3899 GaimConvWindow *win = conv->window; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3900 GaimConversation *c; |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3901 |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3902 if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE)) |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3903 { |
4781 | 3904 GaimBlistNode *n = NULL; |
6695 | 3905 GaimBuddy *b; |
4781 | 3906 memcpy(&n, sd->data, sizeof(n)); |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3907 |
6695 | 3908 if (GAIM_BLIST_NODE_IS_CONTACT(n)) |
3909 b = gaim_contact_get_priority_buddy((GaimContact*)n); | |
3910 else if (GAIM_BLIST_NODE_IS_BUDDY(n)) | |
3911 b = (GaimBuddy*)n; | |
3912 else | |
4781 | 3913 return; |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3914 |
7089
2cd3756a637b
[gaim-migrate @ 7654]
Christian Hammond <chipx86@chipx86.com>
parents:
7078
diff
changeset
|
3915 c = gaim_conversation_new(GAIM_CONV_IM, b->account, b->name); |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3916 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3917 gaim_conv_window_add_conversation(win, c); |
4702 | 3918 } |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3919 else if (sd->target == gdk_atom_intern("application/x-im-contact", FALSE)) |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3920 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3921 char *protocol = NULL; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3922 char *username = NULL; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3923 GaimAccount *account; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3924 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3925 if (gaim_gtk_parse_x_im_contact(sd->data, FALSE, &account, |
7718 | 3926 &protocol, &username, NULL)) |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3927 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3928 if (account == NULL) |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3929 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3930 gaim_notify_error(NULL, NULL, |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3931 _("You are not currently signed on with an account that " |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3932 "can add that buddy."), NULL); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3933 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3934 else |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3935 { |
7718 | 3936 c = gaim_conversation_new(GAIM_CONV_IM, account, username); |
3937 gaim_conv_window_add_conversation(win, c); | |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3938 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3939 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3940 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3941 if (username != NULL) g_free(username); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3942 if (protocol != NULL) g_free(protocol); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3943 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3944 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3945 } |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3946 } |
4359 | 3947 |
3948 /************************************************************************** | |
3949 * GTK+ window ops | |
3950 **************************************************************************/ | |
3951 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3952 gaim_gtk_new_window(GaimConvWindow *win) |
4359 | 3953 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3954 GaimGtkWindow *gtkwin; |
4359 | 3955 GtkPositionType pos; |
3956 GtkWidget *testidea; | |
3957 GtkWidget *menubar; | |
3958 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3959 gtkwin = g_malloc0(sizeof(GaimGtkWindow)); |
4359 | 3960 |
3961 win->ui_data = gtkwin; | |
3962 | |
3963 /* Create the window. */ | |
3964 gtkwin->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
3965 gtk_window_set_role(GTK_WINDOW(gtkwin->window), "conversation"); | |
4635 | 3966 gtk_window_set_resizable(GTK_WINDOW(gtkwin->window), TRUE); |
4510
4c394222c732
[gaim-migrate @ 4786]
Christian Hammond <chipx86@chipx86.com>
parents:
4505
diff
changeset
|
3967 gtk_container_set_border_width(GTK_CONTAINER(gtkwin->window), 0); |
5173 | 3968 GTK_WINDOW(gtkwin->window)->allow_shrink = TRUE; |
4359 | 3969 gtk_widget_realize(gtkwin->window); |
3970 | |
3971 g_signal_connect(G_OBJECT(gtkwin->window), "delete_event", | |
3972 G_CALLBACK(close_win_cb), win); | |
3973 | |
3974 /* Create the notebook. */ | |
3975 gtkwin->notebook = gtk_notebook_new(); | |
3976 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3977 pos = gaim_prefs_get_int("/gaim/gtk/conversations/tab_side"); |
4359 | 3978 |
3979 #if 0 | |
3980 gtk_notebook_set_tab_hborder(GTK_NOTEBOOK(gtkwin->notebook), 0); | |
3981 gtk_notebook_set_tab_vborder(GTK_NOTEBOOK(gtkwin->notebook), 0); | |
3982 #endif | |
3983 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos); | |
3984 gtk_notebook_set_scrollable(GTK_NOTEBOOK(gtkwin->notebook), TRUE); | |
3985 gtk_notebook_popup_enable(GTK_NOTEBOOK(gtkwin->notebook)); | |
4818 | 3986 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), FALSE); |
3987 | |
4359 | 3988 gtk_widget_show(gtkwin->notebook); |
3989 | |
3990 g_signal_connect_after(G_OBJECT(gtkwin->notebook), "switch_page", | |
3991 G_CALLBACK(switch_conv_cb), win); | |
3992 | |
3993 /* Setup the tab drag and drop signals. */ | |
4486 | 3994 gtk_widget_add_events(gtkwin->notebook, |
3995 GDK_BUTTON1_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK); | |
3996 g_signal_connect(G_OBJECT(gtkwin->notebook), "button_press_event", | |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
3997 G_CALLBACK(notebook_press_cb), win); |
4486 | 3998 g_signal_connect(G_OBJECT(gtkwin->notebook), "button_release_event", |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
3999 G_CALLBACK(notebook_release_cb), win); |
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4000 |
4359 | 4001 testidea = gtk_vbox_new(FALSE, 0); |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4002 |
4359 | 4003 /* Setup the menubar. */ |
4004 menubar = setup_menubar(win); | |
4005 gtk_box_pack_start(GTK_BOX(testidea), menubar, FALSE, TRUE, 0); | |
4006 | |
4007 gtk_box_pack_start(GTK_BOX(testidea), gtkwin->notebook, TRUE, TRUE, 0); | |
4008 | |
4009 gtk_container_add(GTK_CONTAINER(gtkwin->window), testidea); | |
4010 | |
4011 gtk_widget_show(testidea); | |
4012 } | |
4013 | |
4014 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4015 gaim_gtk_destroy_window(GaimConvWindow *win) |
4359 | 4016 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4017 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4018 |
4019 gtk_widget_destroy(gtkwin->window); | |
4020 | |
4630 | 4021 g_object_unref(G_OBJECT(gtkwin->menu.item_factory)); |
4022 | |
4359 | 4023 g_free(gtkwin); |
4024 win->ui_data = NULL; | |
4025 } | |
4026 | |
4027 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4028 gaim_gtk_show(GaimConvWindow *win) |
4359 | 4029 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4030 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4031 |
4032 gtk_widget_show(gtkwin->window); | |
7413 | 4033 |
4034 #ifdef _WIN32 | |
7415 | 4035 /* This works around a win32 gtk+ bug, where it can't handle |
4036 * creating the button correctly before the window is shown. | |
4037 * That's why we get the appearance of a button, without all | |
4038 * the normal button-like properties, like being able to click | |
7413 | 4039 * it. ;-) --Nathan */ |
7414 | 4040 if (gaim_prefs_get_bool("/gaim/gtk/conversations/close_on_tabs")) { |
4041 GaimConversation *conv; | |
4042 GaimGtkConversation *gtkconv; | |
4043 | |
4044 conv = gaim_conv_window_get_conversation_at(win, 0); | |
4045 if(conv) { | |
4046 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7415 | 4047 gtk_widget_hide(gtkconv->close); |
7414 | 4048 gtk_widget_show_all(gtkconv->close); |
4049 } | |
4050 } | |
7413 | 4051 #endif |
4359 | 4052 } |
4053 | |
4054 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4055 gaim_gtk_hide(GaimConvWindow *win) |
4359 | 4056 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4057 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4058 |
4059 gtk_widget_hide(gtkwin->window); | |
4060 } | |
4061 | |
4062 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4063 gaim_gtk_raise(GaimConvWindow *win) |
4359 | 4064 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4065 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4066 |
5484 | 4067 gtk_widget_show(gtkwin->window); |
5103 | 4068 gtk_window_deiconify(GTK_WINDOW(gtkwin->window)); |
4526 | 4069 gdk_window_raise(gtkwin->window->window); |
4359 | 4070 } |
4071 | |
4072 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4073 gaim_gtk_flash(GaimConvWindow *win) |
4359 | 4074 { |
4075 #ifdef _WIN32 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4076 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4077 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4078 wgaim_conv_im_blink(gtkwin->window); |
4359 | 4079 #endif |
4080 } | |
4081 | |
4082 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4083 gaim_gtk_switch_conversation(GaimConvWindow *win, unsigned int index) |
4359 | 4084 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4085 GaimGtkWindow *gtkwin; |
4359 | 4086 |
4087 gtkwin = GAIM_GTK_WINDOW(win); | |
4088 | |
4089 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), index); | |
4090 } | |
4091 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4092 static const GtkTargetEntry te[] = |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4093 { |
7695 | 4094 {"text/plain", 0, 0}, |
4095 {"text/uri-list", 0, 1}, | |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4096 {"GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, 2}, |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4097 {"STRING", 0, 3}, |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4098 {"application/x-im-contact", 0, 4} |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4099 }; |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4100 |
4359 | 4101 static void |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4102 gaim_gtk_add_conversation(GaimConvWindow *win, GaimConversation *conv) |
4359 | 4103 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4104 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4105 GaimGtkConversation *gtkconv, *focus_gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4106 GaimConversation *focus_conv; |
4359 | 4107 GtkWidget *pane = NULL; |
4108 GtkWidget *tab_cont; | |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4109 GtkWidget *tabby, *menu_tabby; |
4359 | 4110 gboolean new_ui; |
4383
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4111 GaimConversationType conv_type; |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4112 const char *name; |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4113 |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4114 name = gaim_conversation_get_name(conv); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4115 conv_type = gaim_conversation_get_type(conv); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4116 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4117 |
4118 if (conv->ui_data != NULL) { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4119 gtkconv = (GaimGtkConversation *)conv->ui_data; |
4359 | 4120 |
4121 tab_cont = gtkconv->tab_cont; | |
4122 | |
4123 new_ui = FALSE; | |
4124 } | |
4125 else { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4126 gtkconv = g_malloc0(sizeof(GaimGtkConversation)); |
4359 | 4127 conv->ui_data = gtkconv; |
4128 | |
4129 /* Setup some initial variables. */ | |
4130 gtkconv->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
4131 gtkconv->tooltips = gtk_tooltips_new(); | |
4132 | |
4421 | 4133 /* Setup the foreground and background colors */ |
4134 gaim_gtkconv_update_font_colors(conv); | |
4135 | |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
4136 /* Setup the font face */ |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
4137 gaim_gtkconv_update_font_face(conv); |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
4138 |
7879 | 4139 if (conv_type == GAIM_CONV_IM) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4140 gtkconv->u.im = g_malloc0(sizeof(GaimGtkImPane)); |
4359 | 4141 gtkconv->u.im->a_virgin = TRUE; |
4142 | |
4143 pane = setup_im_pane(conv); | |
4144 } | |
7879 | 4145 else if (conv_type == GAIM_CONV_CHAT) { |
4146 gtkconv->u.chat = g_malloc0(sizeof(GaimGtkChatPane)); | |
4147 | |
4148 pane = setup_chat_pane(conv); | |
4149 } | |
4359 | 4150 |
4151 if (pane == NULL) { | |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4152 if (conv_type == GAIM_CONV_CHAT) g_free(gtkconv->u.chat); |
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4153 else if (conv_type == GAIM_CONV_IM) g_free(gtkconv->u.im); |
4359 | 4154 |
4155 g_free(gtkconv); | |
4156 conv->ui_data = NULL; | |
4157 | |
4158 return; | |
4159 } | |
4160 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4161 /* Setup drag-and-drop */ |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4162 gtk_drag_dest_set(pane, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4163 GTK_DEST_DEFAULT_MOTION | |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4164 GTK_DEST_DEFAULT_DROP, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4165 te, sizeof(te) / sizeof(GtkTargetEntry), |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4166 GDK_ACTION_COPY); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4167 gtk_drag_dest_set(gtkconv->imhtml, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4168 GTK_DEST_DEFAULT_MOTION | |
4702 | 4169 GTK_DEST_DEFAULT_DROP, |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4170 te, sizeof(te) / sizeof(GtkTargetEntry), |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4171 GDK_ACTION_DEFAULT | GDK_ACTION_COPY | GDK_ACTION_MOVE); |
7695 | 4172 gtk_drag_dest_set(gtkconv->entry, |
4173 GTK_DEST_DEFAULT_MOTION | | |
4174 GTK_DEST_DEFAULT_DROP, | |
4175 te, sizeof(te) / sizeof(GtkTargetEntry), | |
4176 GDK_ACTION_COPY); | |
4177 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4178 g_signal_connect(G_OBJECT(pane), "drag_data_received", |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4179 G_CALLBACK(conv_dnd_recv), conv); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4180 g_signal_connect(G_OBJECT(gtkconv->imhtml), "drag_data_received", |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4181 G_CALLBACK(conv_dnd_recv), conv); |
7695 | 4182 #if 0 |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4183 g_signal_connect(G_OBJECT(gtkconv->entry), "drag_data_received", |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4184 G_CALLBACK(conv_dnd_recv), conv); |
7695 | 4185 #endif |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4186 |
4359 | 4187 /* Setup the container for the tab. */ |
4188 gtkconv->tab_cont = tab_cont = gtk_vbox_new(FALSE, 5); | |
4189 gtk_container_set_border_width(GTK_CONTAINER(tab_cont), 5); | |
4190 gtk_container_add(GTK_CONTAINER(tab_cont), pane); | |
4191 gtk_widget_show(pane); | |
4192 | |
4193 new_ui = TRUE; | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
4194 |
4359 | 4195 gtkconv->make_sound = TRUE; |
5902
6889b89cab90
[gaim-migrate @ 6334]
Christian Hammond <chipx86@chipx86.com>
parents:
5901
diff
changeset
|
4196 |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4197 gtkconv->show_formatting_toolbar = gaim_prefs_get_bool( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4198 "/gaim/gtk/conversations/show_formatting_toolbar"); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4199 |
5902
6889b89cab90
[gaim-migrate @ 6334]
Christian Hammond <chipx86@chipx86.com>
parents:
5901
diff
changeset
|
4200 g_signal_connect_swapped(G_OBJECT(pane), "focus", |
7143 | 4201 G_CALLBACK(gtk_widget_grab_focus), |
4202 gtkconv->entry); | |
4359 | 4203 } |
4204 | |
4205 gtkconv->tabby = tabby = gtk_hbox_new(FALSE, 5); | |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4206 gtkconv->menu_tabby = menu_tabby = gtk_hbox_new(FALSE, 5); |
4359 | 4207 |
4208 /* Close button. */ | |
4209 gtkconv->close = gtk_button_new(); | |
4210 gtk_widget_set_size_request(GTK_WIDGET(gtkconv->close), 16, 16); | |
7446
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4211 gtk_button_set_relief(GTK_BUTTON(gtkconv->close), GTK_RELIEF_NONE); |
4359 | 4212 gtk_container_add(GTK_CONTAINER(gtkconv->close), |
4445 | 4213 gtk_image_new_from_stock(GTK_STOCK_CLOSE, |
4214 GTK_ICON_SIZE_MENU)); | |
4359 | 4215 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->close, |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4216 _("Close conversation"), NULL); |
4359 | 4217 |
4218 g_signal_connect(G_OBJECT(gtkconv->close), "clicked", | |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4219 G_CALLBACK(close_conv_cb), conv); |
4359 | 4220 |
7446
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4221 /* |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4222 * I love Galeon. They have a fix for that stupid annoying visible |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4223 * border bug. I love you guys! -- ChipX86 |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4224 */ |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4225 g_signal_connect(G_OBJECT(gtkconv->close), "state_changed", |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4226 G_CALLBACK(tab_close_button_state_changed_cb), NULL); |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4227 |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4228 /* Status icon. */ |
6440 | 4229 gtkconv->icon = gtk_image_new(); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4230 gtkconv->menu_icon = gtk_image_new(); |
6440 | 4231 update_tab_icon(conv); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4232 |
4359 | 4233 /* Tab label. */ |
4234 gtkconv->tab_label = gtk_label_new(gaim_conversation_get_title(conv)); | |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4235 gtkconv->menu_label = gtk_label_new(gaim_conversation_get_title(conv)); |
4359 | 4236 #if 0 |
4237 gtk_misc_set_alignment(GTK_MISC(gtkconv->tab_label), 0.00, 0.5); | |
4238 gtk_misc_set_padding(GTK_MISC(gtkconv->tab_label), 4, 0); | |
4239 #endif | |
4240 | |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
4241 |
4359 | 4242 /* Pack it all together. */ |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4243 gtk_box_pack_start(GTK_BOX(tabby), gtkconv->icon, FALSE, FALSE, 0); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4244 gtk_box_pack_start(GTK_BOX(menu_tabby), gtkconv->menu_icon, FALSE, FALSE, 0); |
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4245 if (gaim_prefs_get_bool("/gaim/gtk/conversations/icons_on_tabs")) { |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4246 gtk_widget_show_all(gtkconv->icon); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4247 gtk_widget_show_all(gtkconv->menu_icon); |
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4248 } |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4249 |
4359 | 4250 gtk_box_pack_start(GTK_BOX(tabby), gtkconv->tab_label, TRUE, TRUE, 0); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4251 gtk_box_pack_start(GTK_BOX(menu_tabby), gtkconv->menu_label, TRUE, TRUE, 0); |
4445 | 4252 gtk_widget_show(gtkconv->tab_label); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4253 gtk_widget_show(gtkconv->menu_label); |
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4254 gtk_misc_set_alignment(GTK_MISC(gtkconv->menu_label), 0, 0); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4255 |
4445 | 4256 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
|
4257 if (gaim_prefs_get_bool("/gaim/gtk/conversations/close_on_tabs")) |
4445 | 4258 gtk_widget_show_all(gtkconv->close); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4259 |
4445 | 4260 gtk_widget_show(tabby); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4261 gtk_widget_show(menu_tabby); |
4359 | 4262 |
7143 | 4263 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
4264 gaim_gtkconv_update_buddy_icon(conv); | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4265 |
4359 | 4266 /* Add this pane to the conversations notebook. */ |
4267 gtk_notebook_append_page(GTK_NOTEBOOK(gtkwin->notebook), tab_cont, tabby); | |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4268 gtk_notebook_set_menu_label(GTK_NOTEBOOK(gtkwin->notebook), tab_cont, menu_tabby); |
4359 | 4269 |
4270 gtk_widget_show(tab_cont); | |
4271 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4272 if (gaim_conv_window_get_conversation_count(win) == 1) { |
4818 | 4273 /* Er, bug in notebooks? Switch to the page manually. */ |
4359 | 4274 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), 0); |
4851 | 4275 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4276 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4277 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4278 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4279 else |
4818 | 4280 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), TRUE); |
4359 | 4281 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4282 focus_conv = g_list_nth_data(gaim_conv_window_get_conversations(win), |
5204 | 4283 gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook))); |
4284 focus_gtkconv = GAIM_GTK_CONVERSATION(focus_conv); | |
4285 gtk_widget_grab_focus(focus_gtkconv->entry); | |
4359 | 4286 |
4287 if (!new_ui) | |
4288 g_object_unref(gtkconv->tab_cont); | |
4289 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4290 if (gaim_conv_window_get_conversation_count(win) == 1) |
4685 | 4291 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); |
4359 | 4292 } |
4293 | |
4294 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4295 gaim_gtk_remove_conversation(GaimConvWindow *win, GaimConversation *conv) |
4359 | 4296 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4297 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4298 GaimGtkConversation *gtkconv; |
4359 | 4299 unsigned int index; |
4818 | 4300 GaimConversationType conv_type; |
4301 | |
4302 conv_type = gaim_conversation_get_type(conv); | |
4359 | 4303 index = gaim_conversation_get_index(conv); |
4304 | |
4305 gtkwin = GAIM_GTK_WINDOW(win); | |
4306 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4307 | |
4308 g_object_ref(gtkconv->tab_cont); | |
4309 gtk_object_sink(GTK_OBJECT(gtkconv->tab_cont)); | |
4310 | |
4311 gtk_notebook_remove_page(GTK_NOTEBOOK(gtkwin->notebook), index); | |
4312 | |
4818 | 4313 /* go back to tabless if need be */ |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4314 if (gaim_conv_window_get_conversation_count(win) <= 2) { |
4818 | 4315 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4316 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); |
4818 | 4317 } |
4318 | |
4319 | |
4359 | 4320 /* If this window is setup with an inactive gc, regenerate the menu. */ |
4818 | 4321 if (conv_type == GAIM_CONV_IM && |
4359 | 4322 gaim_conversation_get_gc(conv) == NULL) { |
4323 | |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
4324 generate_send_as_items(win, conv); |
4359 | 4325 } |
4326 } | |
4327 | |
4328 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4329 gaim_gtk_move_conversation(GaimConvWindow *win, GaimConversation *conv, |
4359 | 4330 unsigned int new_index) |
4331 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4332 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4333 GaimGtkConversation *gtkconv; |
4359 | 4334 |
4335 gtkwin = GAIM_GTK_WINDOW(win); | |
4336 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4337 | |
4415
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4338 if (new_index > gaim_conversation_get_index(conv)) |
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4339 new_index--; |
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4340 |
4359 | 4341 gtk_notebook_reorder_child(GTK_NOTEBOOK(gtkwin->notebook), |
4342 gtkconv->tab_cont, new_index); | |
4343 } | |
4344 | |
4345 static int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4346 gaim_gtk_get_active_index(const GaimConvWindow *win) |
4359 | 4347 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4348 GaimGtkWindow *gtkwin; |
5680
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4349 int index; |
4359 | 4350 |
4351 gtkwin = GAIM_GTK_WINDOW(win); | |
4352 | |
5680
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4353 index = gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook)); |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4354 |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4355 /* |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4356 * A fix, because the first conversation may be active, but not |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4357 * appear in the notebook just yet. -- ChipX86 |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4358 */ |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4359 return (index == -1 ? 0 : index); |
4359 | 4360 } |
4361 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4362 static GaimConvWindowUiOps window_ui_ops = |
4359 | 4363 { |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
4364 gaim_gtk_conversations_get_conv_ui_ops, |
4359 | 4365 gaim_gtk_new_window, |
4366 gaim_gtk_destroy_window, | |
4367 gaim_gtk_show, | |
4368 gaim_gtk_hide, | |
4369 gaim_gtk_raise, | |
4370 gaim_gtk_flash, | |
4371 gaim_gtk_switch_conversation, | |
4372 gaim_gtk_add_conversation, | |
4373 gaim_gtk_remove_conversation, | |
4374 gaim_gtk_move_conversation, | |
4375 gaim_gtk_get_active_index | |
4376 }; | |
4377 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4378 GaimConvWindowUiOps * |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
4379 gaim_gtk_conversations_get_win_ui_ops(void) |
4359 | 4380 { |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4381 return &window_ui_ops; |
4359 | 4382 } |
4383 | |
4384 /************************************************************************** | |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4385 * Conversation UI operations |
4359 | 4386 **************************************************************************/ |
4387 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4388 gaim_gtkconv_destroy(GaimConversation *conv) |
4359 | 4389 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4390 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); |
4359 | 4391 |
4392 if (gtkconv->dialogs.fg_color != NULL) | |
4393 gtk_widget_destroy(gtkconv->dialogs.fg_color); | |
4394 | |
4395 if (gtkconv->dialogs.bg_color != NULL) | |
4396 gtk_widget_destroy(gtkconv->dialogs.bg_color); | |
4397 | |
4398 if (gtkconv->dialogs.font != NULL) | |
4399 gtk_widget_destroy(gtkconv->dialogs.font); | |
4400 | |
5959 | 4401 if (gtkconv->dialogs.image != NULL) |
4402 gtk_widget_destroy(gtkconv->dialogs.image); | |
4403 | |
4359 | 4404 if (gtkconv->dialogs.smiley != NULL) |
4405 gtk_widget_destroy(gtkconv->dialogs.smiley); | |
4406 | |
4407 if (gtkconv->dialogs.link != NULL) | |
4408 gtk_widget_destroy(gtkconv->dialogs.link); | |
4409 | |
4410 if (gtkconv->dialogs.log != NULL) | |
4411 gtk_widget_destroy(gtkconv->dialogs.log); | |
4412 | |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4413 gtk_widget_destroy(gtkconv->tab_cont); |
4892 | 4414 g_object_unref(gtkconv->tab_cont); |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4415 |
4359 | 4416 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
4755 | 4417 if (gtkconv->u.im->icon_timer != 0) |
4418 g_source_remove(gtkconv->u.im->icon_timer); | |
4419 | |
4359 | 4420 if (gtkconv->u.im->save_icon != NULL) |
4421 gtk_widget_destroy(gtkconv->u.im->save_icon); | |
4422 | |
4423 if (gtkconv->u.im->anim != NULL) | |
4793 | 4424 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); |
4359 | 4425 |
4426 g_free(gtkconv->u.im); | |
4427 } | |
4428 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
4429 g_free(gtkconv->u.chat); | |
4430 } | |
4431 | |
4633 | 4432 gtk_object_sink(GTK_OBJECT(gtkconv->tooltips)); |
4433 | |
4359 | 4434 g_free(gtkconv); |
4435 } | |
4436 | |
4437 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4438 gaim_gtkconv_write_im(GaimConversation *conv, const char *who, |
6982 | 4439 const char *message, GaimMessageFlags flags, |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4440 time_t mtime) |
4359 | 4441 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4442 GaimGtkConversation *gtkconv; |
4359 | 4443 |
4444 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4445 | |
6621 | 4446 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4447 gaim_prefs_get_bool("/gaim/gtk/conversations/im/raise_on_events")) { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4448 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4449 gaim_conv_window_raise(gaim_conversation_get_window(conv)); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4450 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4451 |
4382
76223649765b
[gaim-migrate @ 4648]
Christian Hammond <chipx86@chipx86.com>
parents:
4378
diff
changeset
|
4452 /* Play a sound, if specified in prefs. */ |
4359 | 4453 if (gtkconv->make_sound) { |
6621 | 4454 if (flags & GAIM_MESSAGE_RECV) { |
4359 | 4455 if (gtkconv->u.im->a_virgin && |
5820 | 4456 gaim_prefs_get_bool("/gaim/gtk/sound/enabled/first_im_recv")) { |
4359 | 4457 |
4561 | 4458 gaim_sound_play_event(GAIM_SOUND_FIRST_RECEIVE); |
4359 | 4459 } |
4460 else | |
4561 | 4461 gaim_sound_play_event(GAIM_SOUND_RECEIVE); |
4359 | 4462 } |
4463 else { | |
4561 | 4464 gaim_sound_play_event(GAIM_SOUND_SEND); |
4359 | 4465 } |
4466 } | |
4467 | |
4468 gtkconv->u.im->a_virgin = FALSE; | |
4469 | |
6982 | 4470 gaim_conversation_write(conv, who, message, flags, mtime); |
4359 | 4471 } |
4472 | |
4473 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4474 gaim_gtkconv_write_chat(GaimConversation *conv, const char *who, |
6621 | 4475 const char *message, GaimMessageFlags flags, time_t mtime) |
4359 | 4476 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4477 GaimGtkConversation *gtkconv; |
4359 | 4478 |
4479 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4480 | |
4382
76223649765b
[gaim-migrate @ 4648]
Christian Hammond <chipx86@chipx86.com>
parents:
4378
diff
changeset
|
4481 /* Play a sound, if specified in prefs. */ |
4359 | 4482 if (gtkconv->make_sound) { |
6621 | 4483 if (!(flags & GAIM_MESSAGE_WHISPER) && (flags & GAIM_MESSAGE_SEND)) |
4561 | 4484 gaim_sound_play_event(GAIM_SOUND_CHAT_YOU_SAY); |
6621 | 4485 else if (flags & GAIM_MESSAGE_RECV) { |
4486 if ((flags & GAIM_MESSAGE_NICK) && | |
6102 | 4487 gaim_prefs_get_bool("/gaim/gtk/sound/enabled/nick_said")) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4488 |
4561 | 4489 gaim_sound_play_event(GAIM_SOUND_CHAT_NICK); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4490 } |
4359 | 4491 else |
4561 | 4492 gaim_sound_play_event(GAIM_SOUND_CHAT_SAY); |
4359 | 4493 } |
4494 } | |
4495 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4496 if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/color_nicks")) |
6621 | 4497 flags |= GAIM_MESSAGE_COLORIZE; |
4359 | 4498 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4499 /* Raise the window, if specified in prefs. */ |
6621 | 4500 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4501 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4502 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4503 gaim_conv_window_raise(gaim_conversation_get_window(conv)); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4504 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4505 |
6982 | 4506 gaim_conversation_write(conv, who, message, flags, mtime); |
4359 | 4507 } |
4508 | |
4509 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4510 gaim_gtkconv_write_conv(GaimConversation *conv, const char *who, |
6982 | 4511 const char *message, GaimMessageFlags flags, |
4359 | 4512 time_t mtime) |
4513 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4514 GaimGtkConversation *gtkconv; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4515 GaimConvWindow *win; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
4516 GaimConnection *gc; |
4359 | 4517 int gtk_font_options = 0; |
6982 | 4518 GSList *images = NULL; |
7440 | 4519 char buf[BUF_LONG]; |
4359 | 4520 char buf2[BUF_LONG]; |
4521 char mdate[64]; | |
4522 char color[10]; | |
4523 char *str; | |
4524 char *with_font_tag; | |
4896 | 4525 char *sml_attrib = NULL; |
6982 | 4526 size_t length = strlen(message) + 1; |
4895 | 4527 |
4359 | 4528 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4529 gc = gaim_conversation_get_gc(conv); | |
4530 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4531 win = gaim_conversation_get_window(conv); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4532 |
6621 | 4533 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
7431 | 4534 ((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT && |
4535 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) || | |
4536 (gaim_conversation_get_type(conv) == GAIM_CONV_IM && | |
4537 (gaim_prefs_get_bool("/gaim/gtk/conversations/im/raise_on_events") || | |
4538 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
|
4539 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4540 gaim_conv_window_show(win); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4541 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4542 |
7078 | 4543 if (flags & GAIM_MESSAGE_IMAGES) |
4544 gaim_gtk_find_images(message, &images); | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4545 |
5133 | 4546 if(time(NULL) > mtime + 20*60) /* show date if older than 20 minutes */ |
4547 strftime(mdate, sizeof(mdate), "%Y-%m-%d %H:%M:%S", localtime(&mtime)); | |
4548 else | |
4549 strftime(mdate, sizeof(mdate), "%H:%M:%S", localtime(&mtime)); | |
4359 | 4550 |
4896 | 4551 if(gc) |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4552 sml_attrib = g_strdup_printf("sml=\"%s\"", gc->prpl->info->name); |
7440 | 4553 |
4359 | 4554 gtk_font_options ^= GTK_IMHTML_NO_COMMENTS; |
4555 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4556 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_colors")) |
4359 | 4557 gtk_font_options ^= GTK_IMHTML_NO_COLOURS; |
4558 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4559 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_fonts")) |
4359 | 4560 gtk_font_options ^= GTK_IMHTML_NO_FONTS; |
4561 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4562 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_font_sizes")) |
4359 | 4563 gtk_font_options ^= GTK_IMHTML_NO_SIZES; |
4564 | |
6185 | 4565 if (GAIM_PLUGIN_PROTOCOL_INFO(gaim_find_prpl(gaim_account_get_protocol(conv->account)))->options & |
7431 | 4566 OPT_PROTO_USE_POINTSIZE) { |
5367 | 4567 gtk_font_options ^= GTK_IMHTML_USE_POINTSIZE; |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4568 } |
4359 | 4569 |
6621 | 4570 if (flags & GAIM_MESSAGE_SYSTEM) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4571 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) |
5329 | 4572 g_snprintf(buf, BUF_LONG, "(%s) <B>%s</B>", |
7431 | 4573 mdate, message); |
4359 | 4574 else |
4575 g_snprintf(buf, BUF_LONG, "<B>%s</B>", message); | |
7440 | 4576 |
4359 | 4577 g_snprintf(buf2, sizeof(buf2), |
7850 | 4578 "<FONT %s><!--(%s) --><B>%s</B></FONT><BR>", |
4579 sml_attrib, mdate, message); | |
7440 | 4580 |
6982 | 4581 gtk_imhtml_append_text_with_images(GTK_IMHTML(gtkconv->imhtml), buf2, 0, images); |
7440 | 4582 |
7583 | 4583 /* Add the message to a conversations scrollback buffer */ |
4584 conv->history = g_string_append(conv->history, buf); | |
4585 conv->history = g_string_append(conv->history, "<BR>\n"); | |
7440 | 4586 |
7431 | 4587 } else if (flags & GAIM_MESSAGE_NO_LOG) { |
4359 | 4588 g_snprintf(buf, BUF_LONG, |
7850 | 4589 "<B><FONT %s COLOR=\"#777777\">%s</FONT></B><BR>", |
4590 sml_attrib, message); | |
7440 | 4591 |
6982 | 4592 gtk_imhtml_append_text_with_images(GTK_IMHTML(gtkconv->imhtml), buf, 0, images); |
4359 | 4593 } |
4594 else { | |
4895 | 4595 char *new_message = g_memdup(message, length); |
7440 | 4596 |
6621 | 4597 if (flags & GAIM_MESSAGE_WHISPER) { |
4359 | 4598 str = g_malloc(1024); |
7440 | 4599 |
4359 | 4600 /* If we're whispering, it's not an autoresponse. */ |
7564 | 4601 if (gaim_message_meify(new_message, length)) { |
4359 | 4602 g_snprintf(str, 1024, "***%s", who); |
4603 strcpy(color, "#6C2585"); | |
4604 } | |
4605 else { | |
4606 g_snprintf(str, 1024, "*%s*:", who); | |
4607 strcpy(color, "#00FF00"); | |
4608 } | |
7440 | 4609 } |
4359 | 4610 else { |
7564 | 4611 if (gaim_message_meify(new_message, length)) { |
4359 | 4612 str = g_malloc(1024); |
7440 | 4613 |
6621 | 4614 if (flags & GAIM_MESSAGE_AUTO_RESP) |
4359 | 4615 g_snprintf(str, 1024, "%s ***%s", AUTO_RESPONSE, who); |
4616 else | |
4617 g_snprintf(str, 1024, "***%s", who); | |
7440 | 4618 |
6621 | 4619 if (flags & GAIM_MESSAGE_NICK) |
4359 | 4620 strcpy(color, "#AF7F00"); |
4621 else | |
4622 strcpy(color, "#062585"); | |
4623 } | |
4624 else { | |
4625 str = g_malloc(1024); | |
6621 | 4626 if (flags & GAIM_MESSAGE_AUTO_RESP) |
4359 | 4627 g_snprintf(str, 1024, "%s %s", who, AUTO_RESPONSE); |
4628 else | |
4629 g_snprintf(str, 1024, "%s:", who); | |
6621 | 4630 if (flags & GAIM_MESSAGE_NICK) |
4359 | 4631 strcpy(color, "#AF7F00"); |
6621 | 4632 else if (flags & GAIM_MESSAGE_RECV) { |
4633 if (flags & GAIM_MESSAGE_COLORIZE) { | |
4359 | 4634 const char *u; |
4635 int m = 0; | |
7440 | 4636 |
4359 | 4637 for (u = who; *u != '\0'; u++) |
4638 m += *u; | |
7440 | 4639 |
4359 | 4640 m = m % NUM_NICK_COLORS; |
7440 | 4641 |
4359 | 4642 strcpy(color, nick_colors[m]); |
4643 } | |
4644 else | |
7854 | 4645 strcpy(color, RECV_COLOR); |
4359 | 4646 } |
6621 | 4647 else if (flags & GAIM_MESSAGE_SEND) |
7854 | 4648 strcpy(color, SEND_COLOR); |
4359 | 4649 } |
4650 } | |
7440 | 4651 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4652 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) |
4359 | 4653 g_snprintf(buf, BUF_LONG, |
7431 | 4654 "<FONT COLOR=\"%s\" %s>(%s) " |
4655 "<B>%s</B></FONT> ", color, | |
4656 sml_attrib ? sml_attrib : "", mdate, str); | |
4359 | 4657 else |
4658 g_snprintf(buf, BUF_LONG, | |
7431 | 4659 "<FONT COLOR=\"%s\" %s><B>%s</B></FONT> ", color, |
4660 sml_attrib ? sml_attrib : "", str); | |
7440 | 4661 |
4359 | 4662 g_snprintf(buf2, BUF_LONG, |
7431 | 4663 "<FONT COLOR=\"%s\" %s><!--(%s) -->" |
4664 "<B>%s</B></FONT> ", | |
4665 color, sml_attrib ? sml_attrib : "", mdate, str); | |
7440 | 4666 |
4359 | 4667 g_free(str); |
4668 | |
6982 | 4669 gtk_imhtml_append_text_with_images(GTK_IMHTML(gtkconv->imhtml), buf2, 0, images); |
4359 | 4670 |
4895 | 4671 if(gc){ |
4896 | 4672 char *pre = g_strdup_printf("<font %s>", sml_attrib ? sml_attrib : ""); |
4895 | 4673 char *post = "</font>"; |
4674 int pre_len = strlen(pre); | |
4675 int post_len = strlen(post); | |
7440 | 4676 |
4895 | 4677 with_font_tag = g_malloc(length + pre_len + post_len + 1); |
7440 | 4678 |
4895 | 4679 strcpy(with_font_tag, pre); |
4680 memcpy(with_font_tag + pre_len, new_message, length); | |
4681 strcpy(with_font_tag + pre_len + length, post); | |
7440 | 4682 |
4895 | 4683 length += pre_len + post_len; |
4684 g_free(pre); | |
4685 } | |
4608 | 4686 else |
4895 | 4687 with_font_tag = g_memdup(new_message, length); |
7440 | 4688 |
7589 | 4689 gtk_imhtml_append_text_with_images(GTK_IMHTML(gtkconv->imhtml), |
7431 | 4690 with_font_tag, gtk_font_options, images); |
7440 | 4691 |
6982 | 4692 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", 0); |
7440 | 4693 |
7431 | 4694 /*conv->history = g_string_append(conv->history, t1); |
4695 conv->history = g_string_append(conv->history, t2); | |
4696 conv->history = g_string_append(conv->history, "\n"); | |
7440 | 4697 |
7431 | 4698 g_free(t1); |
4699 g_free(t2); */ | |
7440 | 4700 |
4701 g_free(with_font_tag); | |
7447 | 4702 g_free(new_message); |
7440 | 4703 } |
4704 | |
6062 | 4705 |
5012 | 4706 if(sml_attrib) |
4707 g_free(sml_attrib); | |
6982 | 4708 |
4709 if (images) { | |
7078 | 4710 GSList *tmp; |
4711 | |
4712 for (tmp = images; tmp; tmp = tmp->next) { | |
4713 GdkPixbuf *pixbuf = tmp->data; | |
4714 if(pixbuf) | |
4715 g_object_unref(pixbuf); | |
6982 | 4716 } |
7078 | 4717 |
6982 | 4718 g_slist_free(images); |
4719 } | |
4359 | 4720 } |
4721 | |
4722 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4723 gaim_gtkconv_chat_add_user(GaimConversation *conv, const char *user) |
4359 | 4724 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4725 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4726 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4727 GaimGtkChatPane *gtkchat; |
4359 | 4728 char tmp[BUF_LONG]; |
4729 int num_users; | |
4730 int pos; | |
4731 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4732 chat = GAIM_CONV_CHAT(conv); |
4359 | 4733 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4734 gtkchat = gtkconv->u.chat; | |
4735 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4736 num_users = g_list_length(gaim_conv_chat_get_users(chat)); |
4359 | 4737 |
4738 g_snprintf(tmp, sizeof(tmp), | |
4739 ngettext("%d person in room", "%d people in room", | |
4740 num_users), | |
4741 num_users); | |
4742 | |
4743 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); | |
4744 | |
4745 if (gtkconv->make_sound) | |
4561 | 4746 gaim_sound_play_event(GAIM_SOUND_CHAT_JOIN); |
4359 | 4747 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4748 pos = g_list_index(gaim_conv_chat_get_users(chat), user); |
4359 | 4749 |
4750 add_chat_buddy_common(conv, user, pos); | |
4751 } | |
4752 | |
4753 static void | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4754 gaim_gtkconv_chat_add_users(GaimConversation *conv, GList *users) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4755 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4756 GaimConvChat *chat; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4757 GaimGtkConversation *gtkconv; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4758 GaimGtkChatPane *gtkchat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4759 GList *l; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4760 char tmp[BUF_LONG]; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4761 int num_users; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4762 int pos; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4763 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4764 chat = GAIM_CONV_CHAT(conv); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4765 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4766 gtkchat = gtkconv->u.chat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4767 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4768 num_users = g_list_length(gaim_conv_chat_get_users(chat)); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4769 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4770 g_snprintf(tmp, sizeof(tmp), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4771 ngettext("%d person in room", "%d people in room", |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4772 num_users), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4773 num_users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4774 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4775 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4776 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4777 for (l = users; l != NULL; l = l->next) { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4778 pos = g_list_index(gaim_conv_chat_get_users(chat), (char *)l->data); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4779 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4780 add_chat_buddy_common(conv, (char *)l->data, pos); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4781 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4782 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4783 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4784 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4785 gaim_gtkconv_chat_rename_user(GaimConversation *conv, const char *old_name, |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4786 const char *new_name) |
4359 | 4787 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4788 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4789 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4790 GaimGtkChatPane *gtkchat; |
4359 | 4791 GtkTreeIter iter; |
4792 GtkTreeModel *model; | |
4793 GList *names; | |
4794 int pos; | |
4795 int f = 1; | |
4796 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4797 chat = GAIM_CONV_CHAT(conv); |
4359 | 4798 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4799 gtkchat = gtkconv->u.chat; | |
4800 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4801 for (names = gaim_conv_chat_get_users(chat); |
4359 | 4802 names != NULL; |
4803 names = names->next) { | |
4804 | |
4805 char *u = (char *)names->data; | |
4806 | |
4793 | 4807 if (!gaim_utf8_strcasecmp(u, old_name)) { |
4359 | 4808 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
4809 | |
4810 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
4811 break; | |
4812 | |
4813 while (f != 0) { | |
4814 char *val; | |
4815 | |
4816 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &val, -1); | |
4817 | |
4793 | 4818 if (!gaim_utf8_strcasecmp(old_name, val)) { |
4359 | 4819 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
4640 | 4820 break; |
4821 } | |
4359 | 4822 |
4823 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
4824 | |
4825 g_free(val); | |
4826 } | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
4827 |
4359 | 4828 break; |
4829 } | |
4830 } | |
4831 | |
4832 if (!names) | |
4833 return; | |
4834 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4835 pos = g_list_index(gaim_conv_chat_get_users(chat), new_name); |
4359 | 4836 |
4837 add_chat_buddy_common(conv, new_name, pos); | |
4838 } | |
4839 | |
4840 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4841 gaim_gtkconv_chat_remove_user(GaimConversation *conv, const char *user) |
4359 | 4842 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4843 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4844 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4845 GaimGtkChatPane *gtkchat; |
4359 | 4846 GtkTreeIter iter; |
4847 GtkTreeModel *model; | |
4848 GList *names; | |
4849 char tmp[BUF_LONG]; | |
4850 int num_users; | |
4851 int f = 1; | |
4852 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4853 chat = GAIM_CONV_CHAT(conv); |
4359 | 4854 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4855 gtkchat = gtkconv->u.chat; | |
4856 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4857 num_users = g_list_length(gaim_conv_chat_get_users(chat)) - 1; |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4858 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4859 for (names = gaim_conv_chat_get_users(chat); |
4359 | 4860 names != NULL; |
4861 names = names->next) { | |
4862 | |
4863 char *u = (char *)names->data; | |
4864 | |
4793 | 4865 if (!gaim_utf8_strcasecmp(u, user)) { |
4359 | 4866 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
4867 | |
4868 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
4869 break; | |
4870 | |
4871 while (f != 0) { | |
4872 char *val; | |
4873 | |
4874 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &val, -1); | |
4875 | |
4793 | 4876 if (!gaim_utf8_strcasecmp(user, val)) |
4359 | 4877 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
4878 | |
4879 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
4880 | |
4881 g_free(val); | |
4882 } | |
4883 | |
4884 break; | |
4885 } | |
4886 } | |
4887 | |
4888 if (names == NULL) | |
4889 return; | |
4890 | |
4891 g_snprintf(tmp, sizeof(tmp), | |
4892 ngettext("%d person in room", "%d people in room", | |
4893 num_users), num_users); | |
4894 | |
4895 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); | |
4896 | |
4897 if (gtkconv->make_sound) | |
4561 | 4898 gaim_sound_play_event(GAIM_SOUND_CHAT_LEAVE); |
4359 | 4899 } |
4900 | |
4901 static void | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4902 gaim_gtkconv_chat_remove_users(GaimConversation *conv, GList *users) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4903 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4904 GaimConvChat *chat; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4905 GaimGtkConversation *gtkconv; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4906 GaimGtkChatPane *gtkchat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4907 GtkTreeIter iter; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4908 GtkTreeModel *model; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4909 GList *names = NULL; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4910 GList *l; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4911 char tmp[BUF_LONG]; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4912 int num_users; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4913 int f = 1; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4914 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4915 chat = GAIM_CONV_CHAT(conv); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4916 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4917 gtkchat = gtkconv->u.chat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4918 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4919 num_users = g_list_length(gaim_conv_chat_get_users(chat)) - |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4920 g_list_length(users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4921 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4922 for (l = users; l != NULL; l = l->next) { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4923 for (names = gaim_conv_chat_get_users(chat); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4924 names != NULL; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4925 names = names->next) { |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4926 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4927 char *u = (char *)names->data; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4928 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4929 if (!gaim_utf8_strcasecmp(u, (char *)l->data)) { |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4930 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4931 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4932 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4933 &iter)) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4934 break; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4935 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4936 while (f != 0) { |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4937 char *val; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4938 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4939 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4940 1, &val, -1); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4941 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4942 if (!gaim_utf8_strcasecmp((char *)l->data, val)) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4943 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4944 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4945 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4946 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4947 g_free(val); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4948 } |
7431 | 4949 |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4950 break; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4951 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4952 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4953 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4954 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4955 if (names == NULL) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4956 return; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4957 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4958 g_snprintf(tmp, sizeof(tmp), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4959 ngettext("%d person in room", "%d people in room", |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4960 num_users), num_users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4961 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4962 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4963 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4964 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4965 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4966 gaim_gtkconv_set_title(GaimConversation *conv, const char *title) |
4359 | 4967 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4968 GaimGtkConversation *gtkconv; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4969 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4970 GaimGtkWindow *gtkwin; |
4681 | 4971 |
4972 win = gaim_conversation_get_window(conv); | |
4973 gtkwin = GAIM_GTK_WINDOW(win); | |
4359 | 4974 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4975 | |
4976 gtk_label_set_text(GTK_LABEL(gtkconv->tab_label), title); | |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4977 gtk_label_set_text(GTK_LABEL(gtkconv->menu_label), title); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4978 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4979 if(conv == gaim_conv_window_get_active_conversation(win)) |
4681 | 4980 gtk_window_set_title(GTK_WINDOW(gtkwin->window), title); |
4359 | 4981 } |
4982 | |
4983 static void | |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4984 update_tab_icon(GaimConversation *conv) |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4985 { |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4986 GaimGtkConversation *gtkconv; |
7146 | 4987 GaimConvWindow *win = gaim_conversation_get_window(conv); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4988 GaimAccount *account; |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4989 const char *name; |
7008 | 4990 GdkPixbuf *status = NULL; |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4991 |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4992 gtkconv = GAIM_GTK_CONVERSATION(conv); |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4993 name = gaim_conversation_get_name(conv); |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4994 account = gaim_conversation_get_account(conv); |
6440 | 4995 |
7143 | 4996 status = get_tab_icon(conv); |
7008 | 4997 |
4998 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->icon), status); | |
4999 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->menu_icon), status); | |
5000 | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5001 if (gaim_conv_window_get_active_conversation(win) == conv && gtkconv->u.im->anim == NULL) |
7146 | 5002 gtk_window_set_icon(GTK_WINDOW(GAIM_GTK_WINDOW(win)->window), status); |
5003 | |
7008 | 5004 if(status) |
5005 g_object_unref(status); | |
7146 | 5006 |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5007 } |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5008 |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5009 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5010 gaim_gtkconv_updated(GaimConversation *conv, GaimConvUpdateType type) |
4359 | 5011 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5012 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5013 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5014 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5015 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5016 GaimConvChat *chat; |
4359 | 5017 |
5018 win = gaim_conversation_get_window(conv); | |
4736 | 5019 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 5020 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5021 | |
4491 | 5022 if (type == GAIM_CONV_UPDATE_ACCOUNT) { |
4359 | 5023 gaim_conversation_autoset_title(conv); |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5024 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5025 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5026 gaim_gtkconv_update_buddy_icon(conv); |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5027 |
4359 | 5028 gaim_gtkconv_update_buttons_by_protocol(conv); |
5029 | |
4685 | 5030 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); |
4359 | 5031 |
5032 smiley_themeize(gtkconv->imhtml); | |
6394 | 5033 |
6395 | 5034 update_tab_icon(conv); |
4359 | 5035 } |
5036 else if (type == GAIM_CONV_UPDATE_TYPING || | |
5037 type == GAIM_CONV_UPDATE_UNSEEN) { | |
5038 GtkStyle *style; | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5039 GaimConvIm *im = NULL; |
4359 | 5040 |
4736 | 5041 |
4359 | 5042 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5043 im = GAIM_CONV_IM(conv); |
4359 | 5044 |
5045 style = gtk_style_new(); | |
5046 | |
5047 if (!GTK_WIDGET_REALIZED(gtkconv->tab_label)) | |
5048 gtk_widget_realize(gtkconv->tab_label); | |
5049 | |
4757 | 5050 pango_font_description_free(style->font_desc); |
4635 | 5051 style->font_desc = pango_font_description_copy( |
5052 gtk_widget_get_style(gtkconv->tab_label)->font_desc); | |
4359 | 5053 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5054 if (im != NULL && gaim_conv_im_get_typing_state(im) == GAIM_TYPING) { |
4577 | 5055 style->fg[GTK_STATE_NORMAL].red = 0x4646; |
5056 style->fg[GTK_STATE_NORMAL].green = 0xA0A0; | |
5057 style->fg[GTK_STATE_NORMAL].blue = 0x4646; | |
5058 style->fg[GTK_STATE_ACTIVE] = style->fg[GTK_STATE_NORMAL]; | |
4359 | 5059 } |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5060 else if (im != NULL && gaim_conv_im_get_typing_state(im) == GAIM_TYPED) { |
4577 | 5061 style->fg[GTK_STATE_NORMAL].red = 0xD1D1; |
5062 style->fg[GTK_STATE_NORMAL].green = 0x9494; | |
5063 style->fg[GTK_STATE_NORMAL].blue = 0x0C0C; | |
5064 style->fg[GTK_STATE_ACTIVE] = style->fg[GTK_STATE_NORMAL]; | |
4359 | 5065 } |
5066 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_NICK) { | |
4577 | 5067 style->fg[GTK_STATE_ACTIVE].red = 0x3131; |
5068 style->fg[GTK_STATE_ACTIVE].green = 0x4E4E; | |
5069 style->fg[GTK_STATE_ACTIVE].blue = 0x6C6C; | |
4578 | 5070 style->fg[GTK_STATE_NORMAL] = style->fg[GTK_STATE_ACTIVE]; |
4359 | 5071 } |
6405
96de6d9eb422
[gaim-migrate @ 6910]
Christian Hammond <chipx86@chipx86.com>
parents:
6401
diff
changeset
|
5072 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_EVENT) { |
96de6d9eb422
[gaim-migrate @ 6910]
Christian Hammond <chipx86@chipx86.com>
parents:
6401
diff
changeset
|
5073 style->fg[GTK_STATE_ACTIVE].red = 0x8686;; |
96de6d9eb422
[gaim-migrate @ 6910]
Christian Hammond <chipx86@chipx86.com>
parents:
6401
diff
changeset
|
5074 style->fg[GTK_STATE_ACTIVE].green = 0x8282; |
96de6d9eb422
[gaim-migrate @ 6910]
Christian Hammond <chipx86@chipx86.com>
parents:
6401
diff
changeset
|
5075 style->fg[GTK_STATE_ACTIVE].blue = 0x7272; |
96de6d9eb422
[gaim-migrate @ 6910]
Christian Hammond <chipx86@chipx86.com>
parents:
6401
diff
changeset
|
5076 style->fg[GTK_STATE_NORMAL] = style->fg[GTK_STATE_ACTIVE]; |
96de6d9eb422
[gaim-migrate @ 6910]
Christian Hammond <chipx86@chipx86.com>
parents:
6401
diff
changeset
|
5077 } |
4359 | 5078 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_TEXT) { |
4577 | 5079 style->fg[GTK_STATE_ACTIVE].red = 0xDFDF; |
5080 style->fg[GTK_STATE_ACTIVE].green = 0x4242; | |
5081 style->fg[GTK_STATE_ACTIVE].blue = 0x1E1E; | |
4578 | 5082 style->fg[GTK_STATE_NORMAL] = style->fg[GTK_STATE_ACTIVE]; |
4359 | 5083 } |
5084 | |
5085 gtk_widget_set_style(gtkconv->tab_label, style); | |
4635 | 5086 g_object_unref(G_OBJECT(style)); |
4736 | 5087 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5088 if(conv == gaim_conv_window_get_active_conversation(win)) { |
4736 | 5089 update_typing_icon(conv); |
5090 } | |
5091 | |
4359 | 5092 } |
5093 else if (type == GAIM_CONV_UPDATE_TOPIC) { | |
7154 | 5094 const char *topic; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5095 chat = GAIM_CONV_CHAT(conv); |
4359 | 5096 gtkchat = gtkconv->u.chat; |
5097 | |
7154 | 5098 topic = gaim_conv_chat_get_topic(chat); |
5099 | |
5100 gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text),topic); | |
5101 gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->topic_text, | |
5102 topic, NULL); | |
4359 | 5103 } |
5104 else if (type == GAIM_CONV_ACCOUNT_ONLINE || | |
5105 type == GAIM_CONV_ACCOUNT_OFFLINE) { | |
5106 | |
7929 | 5107 gray_stuff_out(gaim_conv_window_get_active_conversation(win)); |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
5108 generate_send_as_items(win, NULL); |
6440 | 5109 if (gaim_prefs_get_bool("/gaim/gtk/conversations/icons_on_tabs")) |
5110 update_tab_icon(conv); | |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5111 } |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5112 else if (type == GAIM_CONV_UPDATE_AWAY) { |
6440 | 5113 if (gaim_prefs_get_bool("/gaim/gtk/conversations/icons_on_tabs")) |
5114 update_tab_icon(conv); | |
4359 | 5115 } |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5116 else if (type == GAIM_CONV_UPDATE_ADD || |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5117 type == GAIM_CONV_UPDATE_REMOVE) { |
4736 | 5118 |
7929 | 5119 gray_stuff_out(conv); |
4397
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
5120 } |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5121 else if (type == GAIM_CONV_UPDATE_ICON) |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5122 { |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5123 gaim_gtkconv_update_buddy_icon(conv); |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5124 } |
4359 | 5125 } |
5126 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5127 static GaimConversationUiOps conversation_ui_ops = |
4359 | 5128 { |
5129 gaim_gtkconv_destroy, /* destroy_conversation */ | |
5130 gaim_gtkconv_write_chat, /* write_chat */ | |
5131 gaim_gtkconv_write_im, /* write_im */ | |
5132 gaim_gtkconv_write_conv, /* write_conv */ | |
5133 gaim_gtkconv_chat_add_user, /* chat_add_user */ | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5134 gaim_gtkconv_chat_add_users, /* chat_add_users */ |
4359 | 5135 gaim_gtkconv_chat_rename_user, /* chat_rename_user */ |
5136 gaim_gtkconv_chat_remove_user, /* chat_remove_user */ | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5137 gaim_gtkconv_chat_remove_users, /* chat_remove_users */ |
4359 | 5138 gaim_gtkconv_set_title, /* set_title */ |
5139 NULL, /* update_progress */ | |
5140 gaim_gtkconv_updated /* updated */ | |
5141 }; | |
5142 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5143 GaimConversationUiOps * |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
5144 gaim_gtk_conversations_get_conv_ui_ops(void) |
4359 | 5145 { |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
5146 return &conversation_ui_ops; |
4359 | 5147 } |
5148 | |
5149 /************************************************************************** | |
5150 * Public conversation utility functions | |
5151 **************************************************************************/ | |
5152 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5153 remove_icon(GaimGtkConversation *gtkconv) |
4359 | 5154 { |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5155 g_return_if_fail(gtkconv != NULL); |
4359 | 5156 |
5157 if (gtkconv->u.im->icon != NULL) | |
5158 gtk_container_remove(GTK_CONTAINER(gtkconv->bbox), | |
5159 gtkconv->u.im->icon->parent->parent); | |
5160 | |
5161 if (gtkconv->u.im->anim != NULL) | |
4793 | 5162 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); |
4359 | 5163 |
5164 if (gtkconv->u.im->icon_timer != 0) | |
5165 g_source_remove(gtkconv->u.im->icon_timer); | |
5166 | |
5167 if (gtkconv->u.im->iter != NULL) | |
5168 g_object_unref(G_OBJECT(gtkconv->u.im->iter)); | |
5169 | |
5170 gtkconv->u.im->icon_timer = 0; | |
5171 gtkconv->u.im->icon = NULL; | |
5172 gtkconv->u.im->anim = NULL; | |
5173 gtkconv->u.im->iter = NULL; | |
5174 } | |
5175 | |
5176 static gboolean | |
5177 redraw_icon(gpointer data) | |
5178 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5179 GaimConversation *conv = (GaimConversation *)data; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5180 GaimGtkConversation *gtkconv; |
4359 | 5181 |
5182 GdkPixbuf *buf; | |
5183 GdkPixbuf *scale; | |
5184 GdkPixmap *pm; | |
5185 GdkBitmap *bm; | |
5186 gint delay; | |
5187 | |
5188 if (!g_list_find(gaim_get_ims(), conv)) { | |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5189 gaim_debug(GAIM_DEBUG_WARNING, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5190 "Conversation not found in redraw_icon. I think this " |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5191 "is a bug.\n"); |
4359 | 5192 return FALSE; |
5193 } | |
5194 | |
5195 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5196 | |
5197 gdk_pixbuf_animation_iter_advance(gtkconv->u.im->iter, NULL); | |
5198 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); | |
5199 | |
5200 scale = gdk_pixbuf_scale_simple(buf, | |
5201 MAX(gdk_pixbuf_get_width(buf) * SCALE(gtkconv->u.im->anim) / | |
5202 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), | |
5203 MAX(gdk_pixbuf_get_height(buf) * SCALE(gtkconv->u.im->anim) / | |
5204 gdk_pixbuf_animation_get_height(gtkconv->u.im->anim), 1), | |
5205 GDK_INTERP_NEAREST); | |
5206 | |
5207 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); | |
4793 | 5208 g_object_unref(G_OBJECT(scale)); |
4635 | 5209 gtk_image_set_from_pixmap(GTK_IMAGE(gtkconv->u.im->icon), pm, bm); |
4793 | 5210 g_object_unref(G_OBJECT(pm)); |
4359 | 5211 gtk_widget_queue_draw(gtkconv->u.im->icon); |
5212 | |
5213 if (bm) | |
4793 | 5214 g_object_unref(G_OBJECT(bm)); |
4359 | 5215 |
5216 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter) / 10; | |
5217 | |
5218 gtkconv->u.im->icon_timer = g_timeout_add(delay * 10, redraw_icon, conv); | |
5219 | |
5220 return FALSE; | |
5221 } | |
5222 | |
5223 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5224 start_anim(GtkObject *obj, GaimConversation *conv) |
4359 | 5225 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5226 GaimGtkConversation *gtkconv; |
4359 | 5227 int delay; |
5228 | |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5229 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
4359 | 5230 return; |
5231 | |
5232 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5233 | |
6016 | 5234 if (gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim)) |
5235 return; | |
5236 | |
4359 | 5237 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter) / 10; |
5238 | |
5239 if (gtkconv->u.im->anim) | |
5240 gtkconv->u.im->icon_timer = g_timeout_add(delay * 10, redraw_icon, | |
5241 conv); | |
5242 } | |
5243 | |
5244 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5245 stop_anim(GtkObject *obj, GaimConversation *conv) |
4359 | 5246 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5247 GaimGtkConversation *gtkconv; |
4359 | 5248 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5249 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
4359 | 5250 return; |
5251 | |
5252 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5253 | |
5254 if (gtkconv->u.im->icon_timer != 0) | |
5255 g_source_remove(gtkconv->u.im->icon_timer); | |
5256 | |
5257 gtkconv->u.im->icon_timer = 0; | |
5258 } | |
5259 | |
7300
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5260 static void |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5261 toggle_icon_animate_cb(GtkWidget *w, GaimConversation *conv) |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5262 { |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5263 if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w))) |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5264 start_anim(NULL, conv); |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5265 else |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5266 stop_anim(NULL, conv); |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5267 } |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5268 |
4359 | 5269 static gboolean |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5270 icon_menu(GtkObject *obj, GdkEventButton *e, GaimConversation *conv) |
4359 | 5271 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5272 GaimGtkConversation *gtkconv; |
4359 | 5273 static GtkWidget *menu = NULL; |
5274 GtkWidget *button; | |
5275 | |
5276 if (e->button != 3 || e->type != GDK_BUTTON_PRESS) | |
5277 return FALSE; | |
5278 | |
5279 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5280 | |
5281 /* | |
5282 * If a menu already exists, destroy it before creating a new one, | |
5283 * thus freeing-up the memory it occupied. | |
5284 */ | |
5285 if (menu != NULL) | |
5286 gtk_widget_destroy(menu); | |
5287 | |
5288 menu = gtk_menu_new(); | |
5289 | |
7300
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5290 if (gtkconv->u.im->anim && |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5291 !(gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim))) |
4359 | 5292 { |
7300
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5293 gaim_new_check_item(menu, _("Animate"), |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5294 G_CALLBACK(toggle_icon_animate_cb), conv, |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5295 gtkconv->u.im->icon_timer); |
4359 | 5296 } |
5297 | |
5298 button = gtk_menu_item_new_with_label(_("Hide Icon")); | |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
5299 g_signal_connect_swapped(G_OBJECT(button), "activate", |
4515
9b9737a00a96
[gaim-migrate @ 4793]
Christian Hammond <chipx86@chipx86.com>
parents:
4513
diff
changeset
|
5300 G_CALLBACK(remove_icon), gtkconv); |
4359 | 5301 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); |
5302 gtk_widget_show(button); | |
5303 | |
7300
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5304 gaim_new_item_from_stock(menu, _("Save Icon As..."), GTK_STOCK_SAVE_AS, |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5305 G_CALLBACK(gaim_gtk_save_icon_dialog), conv, |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5306 0, 0, NULL); |
4359 | 5307 |
5308 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, e->button, e->time); | |
5309 | |
5310 return TRUE; | |
5311 } | |
5312 | |
5313 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5314 gaim_gtkconv_update_buddy_icon(GaimConversation *conv) |
4359 | 5315 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5316 GaimGtkConversation *gtkconv; |
7143 | 5317 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); |
4359 | 5318 |
5319 char filename[256]; | |
5320 FILE *file; | |
5321 GError *err = NULL; | |
5462
8355eeeb52a3
[gaim-migrate @ 5853]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
5322 gboolean animate = TRUE; |
4359 | 5323 |
6695 | 5324 GaimBuddy *buddy; |
4757 | 5325 |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5326 const void *data; |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5327 size_t len; |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5328 int delay; |
4359 | 5329 |
5330 GdkPixbuf *buf; | |
5331 | |
5332 GtkWidget *event; | |
5333 GtkWidget *frame; | |
5334 GdkPixbuf *scale; | |
5335 GdkPixmap *pm; | |
5336 GdkBitmap *bm; | |
5337 int sf = 0; | |
5338 | |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5339 g_return_if_fail(conv != NULL); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5340 g_return_if_fail(GAIM_IS_GTK_CONVERSATION(conv)); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5341 g_return_if_fail(gaim_conversation_get_type(conv) == GAIM_CONV_IM); |
4359 | 5342 |
5343 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5344 | |
5462
8355eeeb52a3
[gaim-migrate @ 5853]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
5345 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
|
5346 animate = FALSE; |
8355eeeb52a3
[gaim-migrate @ 5853]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
5347 |
4359 | 5348 remove_icon(gtkconv); |
5349 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5350 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/im/show_buddy_icons")) |
4359 | 5351 return; |
5352 | |
5353 if (gaim_conversation_get_gc(conv) == NULL) | |
5354 return; | |
5355 | |
4793 | 5356 if(gtkconv->u.im->anim) |
5357 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); | |
5358 | |
4757 | 5359 if((buddy = gaim_find_buddy(gaim_conversation_get_account(conv), |
5360 gaim_conversation_get_name(conv))) != NULL) { | |
7125 | 5361 const char *file; |
7693 | 5362 if((file = gaim_blist_node_get_string((GaimBlistNode*)buddy, "buddy_icon"))) |
4757 | 5363 gtkconv->u.im->anim = gdk_pixbuf_animation_new_from_file(file, &err); |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5364 } |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5365 else |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5366 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5367 GaimBuddyIcon *icon = gaim_conv_im_get_icon(GAIM_CONV_IM(conv)); |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5368 |
6877
1b5b0cea6915
[gaim-migrate @ 7423]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
5369 if (icon == NULL) |
1b5b0cea6915
[gaim-migrate @ 7423]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
5370 return; |
1b5b0cea6915
[gaim-migrate @ 7423]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
5371 |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5372 data = gaim_buddy_icon_get_data(icon, &len); |
4757 | 5373 |
5374 /* this is such an evil hack, i don't know why i'm even considering it. | |
5375 * we'll do it differently when gdk-pixbuf-loader isn't leaky anymore. */ | |
5376 g_snprintf(filename, sizeof(filename), | |
5377 "%s" G_DIR_SEPARATOR_S "gaimicon-%s.%d", | |
5378 g_get_tmp_dir(), gaim_conversation_get_name(conv), getpid()); | |
5379 | |
5380 if (!(file = fopen(filename, "wb"))) | |
5381 return; | |
5382 | |
5383 fwrite(data, 1, len, file); | |
5384 fclose(file); | |
5385 | |
5386 gtkconv->u.im->anim = gdk_pixbuf_animation_new_from_file(filename, &err); | |
5387 /* make sure we remove the file as soon as possible */ | |
5388 unlink(filename); | |
5389 } | |
4359 | 5390 |
5391 if (err) { | |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5392 gaim_debug(GAIM_DEBUG_ERROR, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5393 "Buddy icon error: %s\n", err->message); |
4359 | 5394 g_error_free(err); |
5395 } | |
5396 | |
5397 | |
5398 if (!gtkconv->u.im->anim) | |
5399 return; | |
5400 | |
4793 | 5401 if(gtkconv->u.im->iter) |
5402 g_object_unref(G_OBJECT(gtkconv->u.im->iter)); | |
5403 | |
4359 | 5404 if (gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim)) { |
5405 gtkconv->u.im->iter = NULL; | |
5406 delay = 0; | |
5407 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); | |
5408 } else { | |
5409 gtkconv->u.im->iter = | |
5410 gdk_pixbuf_animation_get_iter(gtkconv->u.im->anim, NULL); | |
5411 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); | |
5412 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter); | |
5413 delay = delay / 10; | |
5414 } | |
5415 | |
5416 sf = SCALE(gtkconv->u.im->anim); | |
5417 scale = gdk_pixbuf_scale_simple(buf, | |
5418 MAX(gdk_pixbuf_get_width(buf) * sf / | |
5419 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), | |
5420 MAX(gdk_pixbuf_get_height(buf) * sf / | |
5421 gdk_pixbuf_animation_get_height(gtkconv->u.im->anim), 1), | |
5422 GDK_INTERP_NEAREST); | |
5423 | |
5424 if (delay) | |
5425 gtkconv->u.im->icon_timer = g_timeout_add(delay * 10, redraw_icon, | |
5426 conv); | |
5427 | |
5428 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); | |
4793 | 5429 g_object_unref(G_OBJECT(scale)); |
4359 | 5430 |
5431 frame = gtk_frame_new(NULL); | |
5432 gtk_frame_set_shadow_type(GTK_FRAME(frame), | |
5433 (bm ? GTK_SHADOW_NONE : GTK_SHADOW_IN)); | |
5434 gtk_box_pack_start(GTK_BOX(gtkconv->bbox), frame, FALSE, FALSE, 5); | |
5435 gtk_box_reorder_child(GTK_BOX(gtkconv->bbox), frame, 0); | |
5436 gtk_widget_show(frame); | |
5437 | |
5438 event = gtk_event_box_new(); | |
5439 gtk_container_add(GTK_CONTAINER(frame), event); | |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
5440 g_signal_connect(G_OBJECT(event), "button-press-event", |
4359 | 5441 G_CALLBACK(icon_menu), conv); |
5442 gtk_widget_show(event); | |
5443 | |
4635 | 5444 gtkconv->u.im->icon = gtk_image_new_from_pixmap(pm, bm); |
4359 | 5445 gtk_widget_set_size_request(gtkconv->u.im->icon, sf, sf); |
5446 gtk_container_add(GTK_CONTAINER(event), gtkconv->u.im->icon); | |
5447 gtk_widget_show(gtkconv->u.im->icon); | |
5448 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5449 if (!animate || |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5450 !gaim_prefs_get_bool("/gaim/gtk/conversations/im/animate_buddy_icons")) { |
4359 | 5451 stop_anim(NULL, conv); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5452 } |
4359 | 5453 |
4793 | 5454 g_object_unref(G_OBJECT(pm)); |
4359 | 5455 |
5456 if (bm) | |
4793 | 5457 g_object_unref(G_OBJECT(bm)); |
7143 | 5458 |
5459 /* The buddy icon code needs badly to be fixed. */ | |
5460 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); | |
5461 gtk_window_set_icon(GTK_WINDOW(gtkwin->window), buf); | |
4359 | 5462 } |
5463 | |
5464 void | |
5465 gaim_gtkconv_update_font_buttons(void) | |
5466 { | |
5467 GList *l; | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5468 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5469 GaimGtkConversation *gtkconv; |
4359 | 5470 |
5471 for (l = gaim_get_ims(); l != NULL; l = l->next) { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5472 conv = (GaimConversation *)l->data; |
4359 | 5473 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5474 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
4359 | 5475 continue; |
5476 | |
5477 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5478 | |
5479 if (gtkconv->toolbar.bold != NULL) | |
5480 gtk_widget_set_sensitive(gtkconv->toolbar.bold, | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5481 !gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold")); |
4359 | 5482 |
5483 if (gtkconv->toolbar.italic != NULL) | |
5484 gtk_widget_set_sensitive(gtkconv->toolbar.italic, | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5485 !gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic")); |
4359 | 5486 |
5487 if (gtkconv->toolbar.underline != NULL) | |
5488 gtk_widget_set_sensitive(gtkconv->toolbar.underline, | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5489 !gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline")); |
4359 | 5490 } |
5491 } | |
5492 | |
5493 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5494 gaim_gtkconv_update_font_colors(GaimConversation *conv) |
4421 | 5495 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5496 GaimGtkConversation *gtkconv; |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
5497 |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5498 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5499 return; |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
5500 |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5501 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5502 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5503 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5504 >kconv->fg_color); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5505 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5506 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5507 >kconv->bg_color); |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5508 } |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5509 |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5510 void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5511 gaim_gtkconv_update_font_face(GaimConversation *conv) |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5512 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5513 GaimGtkConversation *gtkconv; |
6141 | 5514 |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5515 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5516 return; |
6141 | 5517 |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5518 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
5519 |
6141 | 5520 strncpy(gtkconv->fontface, |
5521 gaim_prefs_get_string("/gaim/gtk/conversations/font_face"), | |
5522 sizeof(gtkconv->fontface)); | |
4421 | 5523 } |
5524 | |
5525 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5526 gaim_gtkconv_update_buttons_by_protocol(GaimConversation *conv) |
4359 | 5527 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5528 GaimConvWindow *win; |
4359 | 5529 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5530 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
4359 | 5531 return; |
5532 | |
7887 | 5533 win = gaim_conversation_get_window(conv); |
5534 | |
5535 if (win != NULL && gaim_conv_window_get_active_conversation(win) == conv) | |
5536 gray_stuff_out(conv); | |
4359 | 5537 } |
5538 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5539 GaimConvWindow * |
4359 | 5540 gaim_gtkwin_get_at_xy(int x, int y) |
5541 { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5542 GaimConvWindow *win = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5543 GaimGtkWindow *gtkwin; |
4359 | 5544 GdkWindow *gdkwin; |
5545 GList *l; | |
5546 | |
5547 gdkwin = gdk_window_at_pointer(&x, &y); | |
5548 | |
5549 if (gdkwin) | |
5550 gdkwin = gdk_window_get_toplevel(gdkwin); | |
5551 | |
5552 for (l = gaim_get_windows(); l != NULL; l = l->next) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5553 win = (GaimConvWindow *)l->data; |
4359 | 5554 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5555 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5556 continue; |
5557 | |
5558 gtkwin = GAIM_GTK_WINDOW(win); | |
5559 | |
5560 if (gdkwin == gtkwin->window->window) | |
5561 return win; | |
5562 } | |
5563 | |
5564 return NULL; | |
5565 } | |
5566 | |
5567 int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5568 gaim_gtkconv_get_tab_at_xy(GaimConvWindow *win, int x, int y) |
4359 | 5569 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5570 GaimGtkWindow *gtkwin; |
4359 | 5571 GList *l; |
5572 gint nb_x, nb_y, x_rel, y_rel; | |
5573 GtkNotebook *notebook; | |
5574 GtkWidget *tab; | |
5575 gint i, page_num = 0; | |
5576 gboolean first_visible = TRUE; | |
5577 | |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5578 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5579 return -1; |
5580 | |
5581 gtkwin = GAIM_GTK_WINDOW(win); | |
5582 notebook = GTK_NOTEBOOK(gtkwin->notebook); | |
5583 | |
5584 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
5585 x_rel = x - nb_x; | |
5586 y_rel = y - nb_y; | |
5587 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5588 for (l = gaim_conv_window_get_conversations(win), i = 0; |
4359 | 5589 l != NULL; |
5590 l = l->next, i++) { | |
5591 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5592 GaimConversation *conv = l->data; |
4359 | 5593 tab = GAIM_GTK_CONVERSATION(conv)->tab_label; |
5594 | |
5595 if (!GTK_WIDGET_MAPPED(tab)) | |
5596 continue; | |
5597 | |
5598 if (first_visible) { | |
5599 first_visible = FALSE; | |
5600 | |
5601 if (x_rel < tab->allocation.x) x_rel = tab->allocation.x; | |
5602 if (y_rel < tab->allocation.y) y_rel = tab->allocation.y; | |
5603 } | |
5604 | |
5605 if (gtk_notebook_get_tab_pos(notebook) == GTK_POS_TOP || | |
5606 gtk_notebook_get_tab_pos(notebook) == GTK_POS_BOTTOM) { | |
5607 | |
5608 if (tab->allocation.x <= x_rel) { | |
5609 if (tab->allocation.x + tab->allocation.width <= x_rel) | |
5610 page_num = i + 1; | |
5611 else | |
5612 page_num = i; | |
5613 } | |
5614 else | |
5615 break; | |
5616 } | |
5617 else { | |
5618 if (tab->allocation.y <= y_rel) { | |
5619 if (tab->allocation.y + tab->allocation.height <= y_rel) | |
5620 page_num = i + 1; | |
5621 else | |
5622 page_num = i; | |
5623 } | |
5624 else | |
5625 break; | |
5626 } | |
5627 } | |
5628 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5629 if (i == gaim_conv_window_get_conversation_count(win) + 1) |
4359 | 5630 return -1; |
5631 | |
5632 return page_num; | |
5633 } | |
5634 | |
5635 int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5636 gaim_gtkconv_get_dest_tab_at_xy(GaimConvWindow *win, int x, int y) |
4359 | 5637 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5638 GaimGtkWindow *gtkwin; |
4359 | 5639 GList *l; |
5640 gint nb_x, nb_y, x_rel, y_rel; | |
5641 GtkNotebook *notebook; | |
5642 GtkWidget *tab; | |
5643 gint i, page_num = 0; | |
5644 | |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5645 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5646 return -1; |
5647 | |
5648 gtkwin = GAIM_GTK_WINDOW(win); | |
5649 notebook = GTK_NOTEBOOK(gtkwin->notebook); | |
5650 | |
5651 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
5652 x_rel = x - nb_x; | |
5653 y_rel = y - nb_y; | |
5654 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5655 for (l = gaim_conv_window_get_conversations(win), i = 0; |
4359 | 5656 l != NULL; |
5657 l = l->next, i++) { | |
5658 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5659 GaimConversation *conv = l->data; |
4359 | 5660 tab = GAIM_GTK_CONVERSATION(conv)->tab_label; |
5661 | |
5662 if (!GTK_WIDGET_MAPPED(tab)) | |
5663 continue; | |
5664 | |
5665 if (gtk_notebook_get_tab_pos(notebook) == GTK_POS_TOP || | |
5666 gtk_notebook_get_tab_pos(notebook) == GTK_POS_BOTTOM) { | |
5667 | |
5668 if (tab->allocation.x <= x_rel) { | |
5669 if (tab->allocation.x + (tab->allocation.width / 2) <= x_rel) | |
5670 page_num = i + 1; | |
5671 else | |
5672 page_num = i; | |
5673 } | |
5674 else | |
5675 break; | |
5676 } | |
5677 else { | |
5678 if (tab->allocation.y <= y_rel) { | |
5679 if (tab->allocation.y + (tab->allocation.height / 2) <= y_rel) | |
5680 page_num = i + 1; | |
5681 else | |
5682 page_num = i; | |
5683 } | |
5684 else | |
5685 break; | |
5686 } | |
5687 } | |
5688 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5689 if (i == gaim_conv_window_get_conversation_count(win) + 1) |
4359 | 5690 return -1; |
5691 | |
5692 return page_num; | |
5693 } | |
4940
3708545afe42
[gaim-migrate @ 5274]
Christian Hammond <chipx86@chipx86.com>
parents:
4939
diff
changeset
|
5694 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5695 static void |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5696 escape_closes_pref_cb(const char *name, GaimPrefType type, gpointer value, |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5697 gpointer data) |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5698 { |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5699 if (value) |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5700 gtk_accel_map_change_entry(N_("<main>/Conversation/Close"), |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5701 GDK_Escape, 0, TRUE); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5702 else |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5703 gtk_accel_map_change_entry(N_("<main>/Conversation/Close"), |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5704 GDK_W, GDK_CONTROL_MASK, TRUE); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5705 } |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5706 |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5707 static void |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5708 icons_on_tabs_pref_cb(const char *name, GaimPrefType type, gpointer value, |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5709 gpointer data) |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5710 { |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5711 GList *l; |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5712 GaimConversation *conv; |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5713 GaimGtkConversation *gtkconv; |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5714 |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5715 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5716 conv = (GaimConversation *)l->data; |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5717 |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5718 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5719 continue; |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5720 |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5721 gtkconv = GAIM_GTK_CONVERSATION(conv); |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5722 |
6440 | 5723 if (value) { |
5724 update_tab_icon(conv); | |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5725 gtk_widget_show(gtkconv->icon); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
5726 gtk_widget_show(gtkconv->menu_icon); |
6440 | 5727 } |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
5728 else { |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5729 gtk_widget_hide(gtkconv->icon); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
5730 gtk_widget_hide(gtkconv->menu_icon); |
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
5731 } |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5732 } |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5733 } |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5734 |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5735 static void |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5736 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
|
5737 gpointer data) |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5738 { |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5739 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5740 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5741 GaimGtkConversation *gtkconv; |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5742 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5743 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5744 conv = (GaimConversation *)l->data; |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5745 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5746 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5747 continue; |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5748 |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5749 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5750 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5751 if (value) |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5752 gtk_widget_show(gtkconv->close); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5753 else |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5754 gtk_widget_hide(gtkconv->close); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5755 } |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5756 } |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5757 |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5758 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5759 show_timestamps_pref_cb(const char *name, GaimPrefType type, gpointer value, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5760 gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5761 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5762 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5763 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5764 GaimGtkConversation *gtkconv; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5765 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5766 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5767 conv = (GaimConversation *)l->data; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5768 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5769 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5770 continue; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5771 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5772 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5773 |
7386 | 5774 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), (gboolean)GPOINTER_TO_INT(value)); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5775 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5776 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5777 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5778 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5779 spellcheck_pref_cb(const char *name, GaimPrefType type, gpointer value, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5780 gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5781 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5782 #ifdef USE_GTKSPELL |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5783 GList *cl; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5784 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5785 GaimGtkConversation *gtkconv; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5786 GtkSpell *spell; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5787 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5788 for (cl = gaim_get_conversations(); cl != NULL; cl = cl->next) { |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
5789 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5790 conv = (GaimConversation *)cl->data; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5791 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5792 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5793 continue; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5794 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5795 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5796 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5797 if (value) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
5798 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5799 else { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5800 spell = gtkspell_get_from_text_view(GTK_TEXT_VIEW(gtkconv->entry)); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5801 gtkspell_detach(spell); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5802 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5803 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5804 #endif |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5805 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5806 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5807 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5808 show_smileys_pref_cb(const char *name, GaimPrefType type, gpointer value, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5809 gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5810 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5811 GList *cl; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5812 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5813 GaimGtkConversation *gtkconv; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5814 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5815 for (cl = gaim_get_conversations(); cl != NULL; cl = cl->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5816 conv = (GaimConversation *)cl->data; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5817 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5818 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5819 continue; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5820 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5821 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5822 |
7386 | 5823 gtk_imhtml_show_smileys(GTK_IMHTML(gtkconv->imhtml), (gboolean)GPOINTER_TO_INT(value)); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5824 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5825 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5826 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5827 static void |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5828 tab_side_pref_cb(const char *name, GaimPrefType type, gpointer value, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5829 gpointer data) |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5830 { |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5831 GList *l; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5832 GtkPositionType pos; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5833 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5834 GaimGtkWindow *gtkwin; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5835 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5836 pos = GPOINTER_TO_INT(value); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5837 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5838 for (l = gaim_get_windows(); l != NULL; l = l->next) { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5839 win = (GaimConvWindow *)l->data; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5840 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5841 if (!GAIM_IS_GTK_WINDOW(win)) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5842 continue; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5843 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5844 gtkwin = GAIM_GTK_WINDOW(win); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5845 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5846 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5847 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5848 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5849 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5850 static void |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5851 show_formatting_toolbar_pref_cb(const char *name, GaimPrefType type, |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5852 gpointer value, gpointer data) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5853 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5854 GList *l; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5855 GaimConversation *conv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5856 GaimGtkConversation *gtkconv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5857 GaimConvWindow *win; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5858 GaimGtkWindow *gtkwin; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5859 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5860 for (l = gaim_get_conversations(); l != NULL; l = l->next) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5861 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5862 conv = (GaimConversation *)l->data; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5863 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5864 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5865 continue; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5866 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5867 gtkconv = GAIM_GTK_CONVERSATION(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5868 win = gaim_conversation_get_window(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5869 gtkwin = GAIM_GTK_WINDOW(win); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5870 |
7386 | 5871 gtkconv->show_formatting_toolbar = (gboolean)GPOINTER_TO_INT(value); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5872 gtk_check_menu_item_set_active( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5873 GTK_CHECK_MENU_ITEM(gtkwin->menu.show_formatting_toolbar), |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5874 gtkconv->show_formatting_toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5875 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5876 if (gtkconv->show_formatting_toolbar) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5877 gtk_widget_show(gtkconv->toolbar.toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5878 else |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5879 gtk_widget_hide(gtkconv->toolbar.toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5880 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5881 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5882 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5883 static void |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5884 im_button_type_pref_cb(const char *name, GaimPrefType type, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5885 gpointer value, gpointer data) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5886 { |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5887 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5888 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5889 GaimGtkConversation *gtkconv; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5890 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5891 for (l = gaim_get_ims(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5892 conv = (GaimConversation *)l->data; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5893 gtkconv = GAIM_GTK_CONVERSATION(conv); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5894 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5895 setup_im_buttons(conv, gtk_widget_get_parent(gtkconv->send)); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5896 } |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5897 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5898 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5899 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5900 animate_buddy_icons_pref_cb(const char *name, GaimPrefType type, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5901 gpointer value, gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5902 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5903 GList *l; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5904 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5905 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
|
5906 return; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5907 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5908 if (value) { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5909 for (l = gaim_get_ims(); l != NULL; l = l->next) |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5910 start_anim(NULL, (GaimConversation *)l->data); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5911 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5912 else { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5913 for (l = gaim_get_ims(); l != NULL; l = l->next) |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5914 stop_anim(NULL, (GaimConversation *)l->data); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5915 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5916 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5917 |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5918 static void |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5919 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
|
5920 gpointer data) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5921 { |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5922 GList *l; |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5923 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5924 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5925 GaimConversation *conv = l->data; |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5926 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5927 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5928 gaim_conversation_foreach(gaim_gtkconv_update_buddy_icon); |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5929 } |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5930 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5931 |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5680
diff
changeset
|
5932 static void |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5933 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
|
5934 gpointer data) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5935 { |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5936 GList *l; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5937 GaimConnection *g; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5938 GtkWidget *parent; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5939 GaimConversationType conv_type = GAIM_CONV_CHAT; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5940 GSList *bcs; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5941 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5942 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5943 GaimGtkWindow *gtkwin; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5944 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5945 for (l = gaim_connections_get_all(); l != NULL; l = l->next) { |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5946 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5947 g = (GaimConnection *)l->data; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5948 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5949 for (bcs = g->buddy_chats; bcs != NULL; bcs = bcs->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5950 conv = (GaimConversation *)bcs->data; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5951 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5952 if (gaim_conversation_get_type(conv) != GAIM_CONV_CHAT) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5953 continue; |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
5954 |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5955 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5956 continue; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5957 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5958 gtkconv = GAIM_GTK_CONVERSATION(conv); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5959 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5960 parent = gtk_widget_get_parent(gtkconv->send); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5961 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5962 gtkconv->send = |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5963 gaim_gtk_change_text(_("Send"), |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5964 gtkconv->send, GAIM_STOCK_SEND, conv_type); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5965 gtkconv->u.chat->invite = |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5966 gaim_gtk_change_text(_("Invite"), |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5967 gtkconv->u.chat->invite, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5968 GAIM_STOCK_INVITE, conv_type); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5969 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5970 gtk_box_pack_end(GTK_BOX(parent), gtkconv->send, FALSE, FALSE, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5971 conv_type); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5972 gtk_box_pack_end(GTK_BOX(parent), gtkconv->u.chat->invite, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5973 FALSE, FALSE, 0); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5974 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5975 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->send, 0); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5976 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5977 g_signal_connect(G_OBJECT(gtkconv->send), "clicked", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5978 G_CALLBACK(send_cb), conv); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5979 g_signal_connect(G_OBJECT(gtkconv->u.chat->invite), "clicked", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5980 G_CALLBACK(invite_cb), conv); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5981 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5982 gtk_button_set_relief(GTK_BUTTON(gtkconv->send), |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5983 GTK_RELIEF_NONE); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5984 gtk_button_set_relief(GTK_BUTTON(gtkconv->u.chat->invite), |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5985 GTK_RELIEF_NONE); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5986 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5987 gaim_gtkconv_update_buttons_by_protocol(conv); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5988 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5989 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5990 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5991 |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5992 static void |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5993 conv_placement_pref_cb(const char *name, GaimPrefType type, |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5994 gpointer value, gpointer data) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5995 { |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5996 GaimConvPlacementFunc func; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5997 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5998 if (strcmp(name, "/gaim/gtk/conversations/placement")) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5999 return; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6000 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6001 func = gaim_conv_placement_get_fnc(value); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6002 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6003 if (func == NULL) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6004 return; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6005 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6006 gaim_conv_placement_set_current_func(func); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6007 } |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6008 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6009 void |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
6010 gaim_gtk_conversations_init(void) |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6011 { |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6012 /* Conversations */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6013 gaim_prefs_add_none("/gaim/gtk/conversations"); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
6014 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
|
6015 gaim_prefs_add_bool("/gaim/gtk/conversations/close_on_tabs", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6016 gaim_prefs_add_bool("/gaim/gtk/conversations/ctrl_enter_sends", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6017 gaim_prefs_add_bool("/gaim/gtk/conversations/enter_sends", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6018 gaim_prefs_add_bool("/gaim/gtk/conversations/escape_closes", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6019 gaim_prefs_add_bool("/gaim/gtk/conversations/send_bold", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6020 gaim_prefs_add_bool("/gaim/gtk/conversations/send_italic", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6021 gaim_prefs_add_bool("/gaim/gtk/conversations/send_strikethrough", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6022 gaim_prefs_add_bool("/gaim/gtk/conversations/send_underline", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6023 gaim_prefs_add_bool("/gaim/gtk/conversations/show_smileys", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6024 gaim_prefs_add_bool("/gaim/gtk/conversations/show_timestamps", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6025 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
|
6026 gaim_prefs_add_bool("/gaim/gtk/conversations/spellcheck", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6027 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_colors", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6028 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_fonts", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6029 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_font_sizes", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6030 gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_bgcolor", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6031 gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_fgcolor", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6032 gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_font", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6033 gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_size", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6034 gaim_prefs_add_bool("/gaim/gtk/conversations/html_shortcuts", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6035 gaim_prefs_add_bool("/gaim/gtk/conversations/smiley_shortcuts", FALSE); |
5743
af159a5bbaa0
[gaim-migrate @ 6167]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
6036 gaim_prefs_add_bool("/gaim/gtk/conversations/show_urls_as_links", TRUE); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6037 gaim_prefs_add_bool("/gaim/gtk/conversations/show_formatting_toolbar", TRUE); |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6038 gaim_prefs_add_string("/gaim/gtk/conversations/placement", "last"); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6039 gaim_prefs_add_string("/gaim/gtk/conversations/bgcolor", "#FFFFFF"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6040 gaim_prefs_add_string("/gaim/gtk/conversations/fgcolor", "#000000"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6041 gaim_prefs_add_string("/gaim/gtk/conversations/font_face", ""); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6042 gaim_prefs_add_int("/gaim/gtk/conversations/font_size", 3); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6043 gaim_prefs_add_bool("/gaim/gtk/conversations/tabs", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6044 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
|
6045 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6046 /* Conversations -> Chat */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6047 gaim_prefs_add_none("/gaim/gtk/conversations/chat"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6048 gaim_prefs_add_int("/gaim/gtk/conversations/chat/button_type", |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6049 GAIM_BUTTON_TEXT_IMAGE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6050 gaim_prefs_add_bool("/gaim/gtk/conversations/chat/color_nicks", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6051 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
|
6052 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
|
6053 gaim_prefs_add_bool("/gaim/gtk/conversations/chat/tab_completion", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6054 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_width", 410); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6055 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_height", 160); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6056 gaim_prefs_add_int("/gaim/gtk/conversations/chat/entry_height", 50); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6057 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6058 /* Conversations -> IM */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6059 gaim_prefs_add_none("/gaim/gtk/conversations/im"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6060 gaim_prefs_add_int("/gaim/gtk/conversations/im/button_type", |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6061 GAIM_BUTTON_TEXT_IMAGE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6062 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
|
6063 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
|
6064 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
|
6065 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
|
6066 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_width", 410); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6067 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_height", 160); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6068 gaim_prefs_add_int("/gaim/gtk/conversations/im/entry_height", 50); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6069 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6070 /* Connect callbacks. */ |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6071 gaim_prefs_connect_callback("/gaim/gtk/conversations/escape_closes", |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6072 escape_closes_pref_cb, NULL); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
6073 gaim_prefs_connect_callback("/gaim/gtk/conversations/icons_on_tabs", |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
6074 icons_on_tabs_pref_cb, NULL); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6075 gaim_prefs_connect_callback("/gaim/gtk/conversations/close_on_tabs", |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6076 close_on_tabs_pref_cb, NULL); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6077 gaim_prefs_connect_callback("/gaim/gtk/conversations/show_smileys", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6078 show_smileys_pref_cb, NULL); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6079 gaim_prefs_connect_callback("/gaim/gtk/conversations/show_timestamps", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6080 show_timestamps_pref_cb, NULL); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6081 gaim_prefs_connect_callback("/gaim/gtk/conversations/show_formatting_toolbar", |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6082 show_formatting_toolbar_pref_cb, NULL); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6083 gaim_prefs_connect_callback("/gaim/gtk/conversations/spellcheck", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6084 spellcheck_pref_cb, NULL); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6085 gaim_prefs_connect_callback("/gaim/gtk/conversations/tab_side", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6086 tab_side_pref_cb, NULL); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6087 |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6088 gaim_prefs_connect_callback("/gaim/gtk/conversations/placement", |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6089 conv_placement_pref_cb, NULL); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6090 gaim_prefs_trigger_callback("/gaim/gtk/conversations/placement"); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6091 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6092 |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
6093 |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6094 /* IM callbacks */ |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6095 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/button_type", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6096 im_button_type_pref_cb, NULL); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6097 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/animate_buddy_icons", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6098 animate_buddy_icons_pref_cb, NULL); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6099 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/show_buddy_icons", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6100 show_buddy_icons_pref_cb, NULL); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6101 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6102 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6103 /* Chat callbacks */ |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6104 gaim_prefs_connect_callback("/gaim/gtk/conversations/chat/button_type", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6105 chat_button_type_pref_cb, NULL); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6106 } |