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