Mercurial > pidgin
annotate src/gtkconv.c @ 7961:aca39f227ea0
[gaim-migrate @ 8638]
if anyone reading this is not familliar with the concept of a "teleshot", IM me immediately
Happy Birthday Jon
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Wed, 31 Dec 2003 07:03:18 +0000 |
parents | 1b8261f374ea |
children | 6fca0d9cc98b |
rev | line source |
---|---|
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
1 /** |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
2 * @file gtkconv.h GTK+ Conversation API |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
3 * @ingroup gtkui |
4359 | 4 * |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
5 * Copyright (C) 2002-2003 Christian Hammond <chipx86@gnupdate.org> |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
6 * |
4359 | 7 * This program is free software; you can redistribute it and/or modify |
8 * it under the terms of the GNU General Public License as published by | |
9 * the Free Software Foundation; either version 2 of the License, or | |
10 * (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, | |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 * GNU General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU General Public License | |
18 * along with this program; if not, write to the Free Software | |
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
20 * | |
21 */ | |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
22 #include "gtkinternal.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
23 |
4359 | 24 #ifndef _WIN32 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
25 # include <X11/Xlib.h> |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
26 #endif |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
27 |
4359 | 28 #ifdef USE_GTKSPELL |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
29 # include <gtkspell/gtkspell.h> |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
30 # ifdef _WIN32 |
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
31 # include "wspell.h" |
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
32 # endif |
4359 | 33 #endif |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
34 |
4359 | 35 #include <gdk/gdkkeysyms.h> |
6982 | 36 #include <locale.h> |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
37 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
38 #include "debug.h" |
6982 | 39 #include "imgstore.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
40 #include "log.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
41 #include "multi.h" |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5402
diff
changeset
|
42 #include "notify.h" |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
43 #include "prefs.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
44 #include "prpl.h" |
6038 | 45 #include "request.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
46 #include "sound.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
47 #include "util.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
48 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
49 #include "dnd-hints.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
50 #include "gtkblist.h" |
5717 | 51 #include "gtkconv.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
52 #include "gtkimhtml.h" |
7431 | 53 #include "gtklog.h" |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
54 #include "gtkpounce.h" |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
55 #include "gtkprivacy.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
56 #include "gtkutils.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
57 #include "stock.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
58 |
5717 | 59 #include "ui.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
60 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
61 /* XXX */ |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
62 #include "gaim.h" |
4359 | 63 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
64 #define AUTO_RESPONSE "<AUTO-REPLY> : " |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
65 |
7854 | 66 #define SEND_COLOR "#267726" |
7855 | 67 #define RECV_COLOR "#A82F2F" |
7854 | 68 |
4359 | 69 static char nick_colors[][8] = { |
70 "#ba55d3", /* Medium Orchid */ | |
71 "#ee82ee", /* Violet */ | |
72 "#c715b4", /* Medium Violet Red */ | |
73 "#ff69b4", /* Hot Pink */ | |
74 "#ff6347", /* Tomato */ | |
75 "#fa8c00", /* Dark Orange */ | |
76 "#fa8072", /* Salmon */ | |
77 "#b22222", /* Fire Brick */ | |
78 "#f4a460", /* Sandy Brown */ | |
79 "#cd5c5c", /* Indian Red */ | |
80 "#bc8f8f", /* Rosy Brown */ | |
81 "#f0e68c", /* Khaki */ | |
82 "#bdb76b", /* Dark Khaki */ | |
83 "#228b22", /* Forest Green */ | |
84 "#9acd32", /* Yellow Green */ | |
85 "#32cd32", /* Lime Green */ | |
7755 | 86 "#3cb371", /* Medium Sea Green (Medium Sea Green?! What are we women?!) */ |
4359 | 87 "#2e8b57", /* Sea Green */ |
88 "#8fbc8f", /* Dark Sea Green */ | |
89 "#66cdaa", /* Medium Aquamarine */ | |
90 "#5f9ea0", /* Cadet Blue */ | |
91 "#48d1cc", /* Medium Turquoise */ | |
92 "#00ced1", /* Dark Turquoise */ | |
93 "#4682b4", /* Stell Blue */ | |
94 "#00bfff", /* Deep Sky Blue */ | |
95 "#1690ff", /* Dodger Blue */ | |
96 "#4169ff", /* Royal Blue */ | |
97 "#6a5acd", /* Slate Blue */ | |
98 "#6495ed", /* Cornflower Blue */ | |
99 "#708090", /* Slate gray */ | |
6291 | 100 "#2f4f4f", /* Dark Slate Gray */ |
101 "#ff8c00", /* Dark Orange */ | |
4359 | 102 }; |
6291 | 103 |
4359 | 104 #define NUM_NICK_COLORS (sizeof(nick_colors) / sizeof(*nick_colors)) |
105 | |
106 #define SCALE(x) \ | |
107 ((gdk_pixbuf_animation_get_width(x) <= 48 && \ | |
108 gdk_pixbuf_animation_get_height(x) <= 48) ? 48 : 50) | |
109 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
110 typedef struct |
4359 | 111 { |
112 GtkWidget *window; | |
113 | |
114 GtkWidget *entry; | |
115 GtkWidget *message; | |
116 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
117 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
118 |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
119 } InviteBuddyInfo; |
4359 | 120 |
121 static GtkWidget *invite_dialog = NULL; | |
122 | |
123 /* Prototypes. <-- because Paco-Paco hates this comment. */ | |
124 static void check_everything(GtkTextBuffer *buffer); | |
4685 | 125 static void set_toggle(GtkWidget *tb, gboolean active); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
126 static void move_next_tab(GaimConversation *conv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
127 static void do_bold(GtkWidget *bold, GaimGtkConversation *gtkconv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
128 static void do_italic(GtkWidget *italic, GaimGtkConversation *gtkconv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
129 static void do_underline(GtkWidget *underline, GaimGtkConversation *gtkconv); |
7242
59ffe137176d
[gaim-migrate @ 7817]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7222
diff
changeset
|
130 static void do_small(GtkWidget *smalltb, GaimGtkConversation *gtkconv); |
59ffe137176d
[gaim-migrate @ 7817]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7222
diff
changeset
|
131 static void do_big(GtkWidget *large, GaimGtkConversation *gtkconv); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
132 static void toggle_font(GtkWidget *font, GaimConversation *conv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
133 static void toggle_fg_color(GtkWidget *color, GaimConversation *conv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
134 static void toggle_bg_color(GtkWidget *color, GaimConversation *conv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
135 static void got_typing_keypress(GaimConversation *conv, gboolean first); |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
136 static GList *generate_invite_user_names(GaimConnection *gc); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
137 static void add_chat_buddy_common(GaimConversation *conv, |
4359 | 138 const char *name, int pos); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
139 static void tab_complete(GaimConversation *conv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
140 static void update_typing_icon(GaimConversation *conv); |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
141 static gboolean update_send_as_selection(GaimConvWindow *win); |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
142 static char *item_factory_translate_func (const char *path, gpointer func_data); |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
143 static void save_convo(GtkWidget *save, GaimConversation *c); |
6440 | 144 static void update_tab_icon(GaimConversation *conv); |
4359 | 145 |
146 /************************************************************************** | |
147 * Callbacks | |
148 **************************************************************************/ | |
149 static void | |
6038 | 150 do_save_convo(GtkWidget *wid) |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
151 { |
6039 | 152 GaimConversation *c = g_object_get_data(G_OBJECT(GTK_FILE_SELECTION(wid)->ok_button), |
6038 | 153 "gaim_conversation"); |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
154 const char *filename; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
155 FILE *fp; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
156 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
157 filename = gtk_file_selection_get_filename(GTK_FILE_SELECTION(wid)); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
158 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
159 if (!((gaim_conversation_get_type(c) != GAIM_CONV_CHAT && |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
160 g_list_find(gaim_get_ims(), c)) || |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
161 (gaim_conversation_get_type(c) == GAIM_CONV_CHAT && |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
162 g_list_find(gaim_get_chats(), c)))) |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
163 filename = NULL; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
164 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
165 gtk_widget_destroy(wid); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
166 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
167 if (filename == NULL) |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
168 return; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
169 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
170 if ((fp = fopen(filename, "w+")) == NULL) |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
171 return; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
172 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
173 fprintf(fp, "%s", c->history->str); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
174 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
175 fclose(fp); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
176 } |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
177 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
178 static void |
6038 | 179 do_check_save_convo(GObject *obj, GtkWidget *wid) |
180 { | |
181 const char *filename = gtk_file_selection_get_filename(GTK_FILE_SELECTION(wid)); | |
182 | |
183 if (gaim_gtk_check_if_dir(filename, GTK_FILE_SELECTION(wid))) | |
184 return; | |
185 | |
186 if(g_file_test(filename, G_FILE_TEST_EXISTS)){ | |
187 gaim_request_yes_no(NULL, NULL, _("That file already exists"), | |
188 _("Would you like to overwrite it?"), 1, wid, | |
189 G_CALLBACK(do_save_convo), NULL); | |
190 } | |
191 else | |
192 do_save_convo(wid); | |
193 } | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6460
diff
changeset
|
194 |
6038 | 195 static void |
7927 | 196 do_insert_image_cb(GtkWidget *widget, int resp, gpointer data) |
4359 | 197 { |
7927 | 198 GaimConversation *conv = data; |
199 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); | |
200 GaimConvIm *im = GAIM_CONV_IM(conv); | |
6982 | 201 char *name, *filename; |
7927 | 202 char *buf, *filedata; |
6982 | 203 size_t size; |
7927 | 204 GError *error = NULL; |
4359 | 205 int id; |
206 | |
7927 | 207 if (resp != GTK_RESPONSE_OK) { |
208 set_toggle(gtkconv->toolbar.image, FALSE); | |
209 return; | |
210 } | |
211 | |
212 name = g_strdup(gtk_file_selection_get_filename(GTK_FILE_SELECTION(widget))); | |
6982 | 213 |
214 if (!name) { | |
7927 | 215 set_toggle(gtkconv->toolbar.image, FALSE); |
6982 | 216 return; |
217 } | |
218 | |
7927 | 219 if (gaim_gtk_check_if_dir(name, GTK_FILE_SELECTION(widget))) { |
6982 | 220 g_free(name); |
7927 | 221 set_toggle(gtkconv->toolbar.image, FALSE); |
4359 | 222 return; |
6982 | 223 } |
224 | |
7927 | 225 set_toggle(gtkconv->toolbar.image, FALSE); |
226 | |
227 if (!g_file_get_contents(name, &filedata, &size, &error)) { | |
6982 | 228 gaim_notify_error(NULL, NULL, error->message, NULL); |
229 | |
230 g_error_free(error); | |
231 g_free(name); | |
232 | |
4359 | 233 return; |
234 } | |
235 | |
236 filename = name; | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
237 while (strchr(filename, '/')) |
4359 | 238 filename = strchr(filename, '/') + 1; |
239 | |
7927 | 240 id = gaim_imgstore_add(filedata, size, filename); |
241 g_free(filedata); | |
6982 | 242 |
243 if (!id) { | |
244 buf = g_strdup_printf(_("Failed to store image: %s\n"), name); | |
245 gaim_notify_error(NULL, NULL, buf, NULL); | |
246 | |
247 g_free(buf); | |
248 g_free(name); | |
249 | |
250 return; | |
251 } | |
252 | |
253 im->images = g_slist_append(im->images, GINT_TO_POINTER(id)); | |
254 | |
255 buf = g_strdup_printf("<IMG ID=\"%d\" SRC=\"file://%s\">", id, filename); | |
256 gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(gtkconv->entry_buffer), buf, -1); | |
4359 | 257 g_free(buf); |
5046 | 258 |
6982 | 259 g_free(name); |
4359 | 260 } |
261 | |
262 static gint | |
263 close_win_cb(GtkWidget *w, GdkEventAny *e, gpointer d) | |
264 { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
265 GaimConvWindow *win = (GaimConvWindow *)d; |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
266 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
267 gaim_conv_window_destroy(win); |
4361
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
268 |
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
269 return TRUE; |
4359 | 270 } |
271 | |
272 static gint | |
273 close_conv_cb(GtkWidget *w, gpointer d) | |
274 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
275 GaimConversation *conv = (GaimConversation *)d; |
4359 | 276 |
277 gaim_conversation_destroy(conv); | |
4361
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
278 |
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
279 return TRUE; |
4359 | 280 } |
281 | |
7446
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
282 /* Courtesy of Galeon! */ |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
283 static void |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
284 tab_close_button_state_changed_cb(GtkWidget *widget, GtkStateType prev_state) |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
285 { |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
286 if (GTK_WIDGET_STATE(widget) == GTK_STATE_ACTIVE) |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
287 gtk_widget_set_state(widget, GTK_STATE_NORMAL); |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
288 } |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
289 |
4359 | 290 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
291 insert_image_cb(GtkWidget *save, GaimConversation *conv) |
4359 | 292 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
293 GaimGtkConversation *gtkconv; |
4359 | 294 char buf[BUF_LONG]; |
295 GtkWidget *window; | |
296 | |
297 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
298 | |
5046 | 299 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.image))) { |
7853 | 300 window = gtk_file_selection_new(_("Insert Image")); |
5046 | 301 g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S, gaim_home_dir()); |
302 gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf); | |
303 | |
7927 | 304 gtk_dialog_set_default_response(GTK_DIALOG(window), GTK_RESPONSE_OK); |
305 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(window)), | |
306 "response", G_CALLBACK(do_insert_image_cb), conv); | |
5046 | 307 |
308 gtk_widget_show(window); | |
5106 | 309 gtkconv->dialogs.image = window; |
5046 | 310 } else { |
7927 | 311 gtk_widget_destroy(gtkconv->dialogs.image); |
5106 | 312 gtkconv->dialogs.image = NULL; |
5046 | 313 } |
4359 | 314 } |
315 | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5402
diff
changeset
|
316 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
317 insert_link_cb(GtkWidget *w, GaimConversation *conv) |
4359 | 318 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
319 GaimGtkConversation *gtkconv; |
4359 | 320 |
321 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
322 | |
323 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.link))) | |
7927 | 324 dialog_link_show(conv); |
4359 | 325 else |
7927 | 326 dialog_link_destroy(conv); |
4359 | 327 |
328 gtk_widget_grab_focus(gtkconv->entry); | |
329 } | |
330 | |
331 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
332 insert_smiley_cb(GtkWidget *smiley, GaimConversation *conv) |
4359 | 333 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
334 GaimGtkConversation *gtkconv; |
4359 | 335 |
336 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
337 | |
338 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(smiley))) | |
339 show_smiley_dialog(conv, smiley); | |
340 else if (gtkconv->dialogs.smiley) | |
341 close_smiley_dialog(smiley, conv); | |
342 | |
343 gtk_widget_grab_focus(gtkconv->entry); | |
344 } | |
345 | |
346 static gboolean | |
347 entry_key_pressed_cb_1(GtkTextBuffer *buffer) | |
348 { | |
349 check_everything(buffer); | |
350 | |
351 return FALSE; | |
352 } | |
353 | |
7766 | 354 static void default_formatize(GaimConversation *conv) { |
355 GaimGtkConversation *c = GAIM_GTK_CONVERSATION(conv); | |
356 GaimConnection *gc = gaim_conversation_get_gc(conv); | |
357 | |
358 if (gc && gc->flags & GAIM_CONNECTION_HTML) { | |
359 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold")) { | |
360 gtk_imhtml_toggle_bold(GTK_IMHTML(c->entry)); | |
361 } | |
362 | |
363 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic")) { | |
364 gtk_imhtml_toggle_italic(GTK_IMHTML(c->entry)); | |
365 } | |
366 | |
367 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline")) { | |
368 gtk_imhtml_toggle_underline(GTK_IMHTML(c->entry)); | |
369 } | |
370 | |
371 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_strikethrough")) { | |
372 /* Tell me noone uses <s> by default ... maybe I won't do | |
373 _toggle_strikethrough and not let them */ | |
374 /* g_snprintf(buf2, limit, "<STRIKE>%s</STRIKE>", buf); | |
375 strcpy(buf, buf2); */ | |
376 } | |
377 | |
378 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_font") || c->has_font) { | |
379 gtk_imhtml_toggle_fontface(GTK_IMHTML(c->entry), c->fontface); | |
380 } | |
381 | |
382 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_size")) { | |
7778 | 383 gtk_imhtml_font_set_size(GTK_IMHTML(c->entry), gaim_prefs_get_int("/gaim/gtk/conversations/font_size")); |
7766 | 384 } |
385 | |
386 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_fgcolor")) { | |
387 char *color = g_strdup_printf("#%02x%02x%02x", | |
388 c->fg_color.red / 256, | |
389 c->fg_color.green / 256, | |
390 c->fg_color.blue / 256); | |
391 gtk_imhtml_toggle_forecolor(GTK_IMHTML(c->entry), color); | |
392 g_free(color); | |
393 } | |
394 | |
395 if (!(gc->flags & GAIM_CONNECTION_NO_BGCOLOR) && gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_bgcolor")) { | |
396 char *color = g_strdup_printf("#%02x%02x%02x", | |
397 c->bg_color.red / 256, | |
398 c->bg_color.green / 256, | |
399 c->bg_color.blue / 256); | |
400 gtk_imhtml_toggle_backcolor(GTK_IMHTML(c->entry), color); | |
401 g_free(color); | |
402 } | |
403 } | |
404 } | |
405 | |
4359 | 406 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
407 send_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 408 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
409 GaimGtkConversation *gtkconv; |
7946 | 410 char *buf; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
411 GaimConnection *gc = gaim_conversation_get_gc(conv); |
4359 | 412 |
413 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7715 | 414 |
415 if (gc && gc->flags & GAIM_CONNECTION_HTML) | |
7946 | 416 buf = gtk_imhtml_get_markup(GTK_IMHTML(gtkconv->entry)); |
7715 | 417 else |
7946 | 418 buf = gtk_imhtml_get_text(GTK_IMHTML(gtkconv->entry)); |
7695 | 419 |
420 /* set_toggle(gtkconv->toolbar.bold, FALSE); | |
4685 | 421 set_toggle(gtkconv->toolbar.italic, FALSE); |
422 set_toggle(gtkconv->toolbar.underline, FALSE); | |
5049 | 423 set_toggle(gtkconv->toolbar.larger_size, FALSE); |
4685 | 424 set_toggle(gtkconv->toolbar.normal_size, FALSE); |
5049 | 425 set_toggle(gtkconv->toolbar.smaller_size,FALSE); |
4685 | 426 set_toggle(gtkconv->toolbar.font, FALSE); |
427 set_toggle(gtkconv->toolbar.fgcolor, FALSE); | |
428 set_toggle(gtkconv->toolbar.bgcolor, FALSE); | |
429 set_toggle(gtkconv->toolbar.link, FALSE); | |
7695 | 430 */ |
4359 | 431 gtk_widget_grab_focus(gtkconv->entry); |
432 | |
433 if (strlen(buf) == 0) { | |
434 g_free(buf); | |
435 | |
436 return; | |
437 } | |
438 | |
439 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
440 gaim_conv_im_send(GAIM_CONV_IM(conv), buf); |
7879 | 441 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
442 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), buf); |
4359 | 443 |
5629 | 444 if (gaim_prefs_get_bool("/gaim/gtk/conversations/im/hide_on_send")) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
445 gaim_conv_window_hide(gaim_conversation_get_window(conv)); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
446 |
4359 | 447 g_free(buf); |
448 | |
7695 | 449 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); |
7766 | 450 default_formatize(conv); |
4359 | 451 } |
452 | |
453 static void | |
7928 | 454 add_remove_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 455 { |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
456 GaimAccount *account; |
4359 | 457 const char *name; |
458 | |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
459 account = gaim_conversation_get_account(conv); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
460 name = gaim_conversation_get_name(conv); |
7879 | 461 |
462 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
7859 | 463 GaimBuddy *b; |
464 | |
465 b = gaim_find_buddy(account, name); | |
466 if (b != NULL) | |
467 show_confirm_del(b); | |
468 else if (account != NULL && gaim_account_is_connected(account)) | |
469 gaim_blist_request_add_buddy(account, (char *)name, NULL, NULL); | |
7879 | 470 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
7859 | 471 GaimChat *c; |
472 | |
473 c = gaim_blist_find_chat(account, name); | |
474 if (c != NULL) | |
475 show_confirm_del_blist_chat(c); | |
476 else if (account != NULL && gaim_account_is_connected(account)) | |
477 gaim_blist_request_add_chat(account, NULL, NULL); | |
478 } | |
4359 | 479 |
480 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
481 } | |
482 | |
483 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
484 info_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 485 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
486 GaimGtkConversation *gtkconv; |
4359 | 487 |
488 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
489 | |
7879 | 490 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
491 serv_get_info(gaim_conversation_get_gc(conv), | |
492 gaim_conversation_get_name(conv)); | |
493 | |
494 gtk_widget_grab_focus(gtkconv->entry); | |
495 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
496 /* Get info of the person currently selected in the GtkTreeView */ | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
497 GaimGtkChatPane *gtkchat; |
4359 | 498 GtkTreeIter iter; |
499 GtkTreeModel *model; | |
500 GtkTreeSelection *sel; | |
501 const char *name; | |
502 | |
503 gtkchat = gtkconv->u.chat; | |
504 | |
505 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | |
506 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); | |
507 | |
508 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) | |
509 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &name, -1); | |
510 else | |
511 return; | |
512 | |
7879 | 513 serv_get_info(gaim_conversation_get_gc(conv), name); |
4359 | 514 } |
515 } | |
516 | |
517 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
518 warn_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 519 { |
520 show_warn_dialog(gaim_conversation_get_gc(conv), | |
7879 | 521 gaim_conversation_get_name(conv)); |
4359 | 522 |
523 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
524 } | |
525 | |
526 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
527 block_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 528 { |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
529 GaimAccount *account; |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
530 |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
531 account = gaim_conversation_get_account(conv); |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
532 |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
533 if (account != NULL && gaim_account_is_connected(account)) |
6399
d726a36628e8
[gaim-migrate @ 6904]
Christian Hammond <chipx86@chipx86.com>
parents:
6398
diff
changeset
|
534 gaim_gtk_request_add_block(account, gaim_conversation_get_name(conv)); |
4359 | 535 |
536 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
537 } | |
538 | |
539 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
540 do_invite(GtkWidget *w, int resp, InviteBuddyInfo *info) |
4359 | 541 { |
542 const char *buddy, *message; | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
543 GaimGtkConversation *gtkconv; |
4359 | 544 |
545 gtkconv = GAIM_GTK_CONVERSATION(info->conv); | |
546 | |
547 if (resp == GTK_RESPONSE_OK) { | |
548 buddy = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(info->entry)->entry)); | |
549 message = gtk_entry_get_text(GTK_ENTRY(info->message)); | |
550 | |
4793 | 551 if (!g_ascii_strcasecmp(buddy, "")) { |
4359 | 552 g_free(info); |
553 | |
554 return; | |
555 } | |
556 | |
557 serv_chat_invite(gaim_conversation_get_gc(info->conv), | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
558 gaim_conv_chat_get_id(GAIM_CONV_CHAT(info->conv)), |
4359 | 559 message, buddy); |
560 } | |
561 | |
562 gtk_widget_destroy(invite_dialog); | |
563 invite_dialog = NULL; | |
564 | |
565 g_free(info); | |
566 } | |
567 | |
568 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
569 invite_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 570 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
571 InviteBuddyInfo *info = NULL; |
4359 | 572 |
573 if (invite_dialog == NULL) { | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
574 GaimConnection *gc; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
575 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
576 GaimGtkWindow *gtkwin; |
4359 | 577 GtkWidget *label; |
578 GtkWidget *vbox, *hbox; | |
579 GtkWidget *table; | |
580 GtkWidget *img; | |
581 | |
5024 | 582 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG); |
4359 | 583 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
584 info = g_new0(InviteBuddyInfo, 1); |
4359 | 585 info->conv = conv; |
586 | |
587 gc = gaim_conversation_get_gc(conv); | |
588 win = gaim_conversation_get_window(conv); | |
589 gtkwin = GAIM_GTK_WINDOW(win); | |
590 | |
591 /* Create the new dialog. */ | |
592 invite_dialog = gtk_dialog_new_with_buttons( | |
7859 | 593 _("Invite Buddy Into Chat Room"), |
7879 | 594 GTK_WINDOW(gtkwin->window), 0, |
595 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, | |
4359 | 596 GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); |
597 | |
598 gtk_dialog_set_default_response(GTK_DIALOG(invite_dialog), | |
599 GTK_RESPONSE_OK); | |
600 gtk_container_set_border_width(GTK_CONTAINER(invite_dialog), 6); | |
601 gtk_window_set_resizable(GTK_WINDOW(invite_dialog), FALSE); | |
602 gtk_dialog_set_has_separator(GTK_DIALOG(invite_dialog), FALSE); | |
603 | |
604 /* Setup the outside spacing. */ | |
605 vbox = GTK_DIALOG(invite_dialog)->vbox; | |
606 | |
607 gtk_box_set_spacing(GTK_BOX(vbox), 12); | |
608 gtk_container_set_border_width(GTK_CONTAINER(vbox), 6); | |
609 | |
610 /* Setup the inner hbox and put the dialog's icon in it. */ | |
611 hbox = gtk_hbox_new(FALSE, 12); | |
612 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
613 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
614 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
615 | |
616 /* Setup the right vbox. */ | |
617 vbox = gtk_vbox_new(FALSE, 0); | |
618 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
619 | |
620 /* Put our happy label in it. */ | |
621 label = gtk_label_new(_("Please enter the name of the user you wish " | |
622 "to invite, along with an optional invite " | |
623 "message.")); | |
624 gtk_widget_set_size_request(label, 350, -1); | |
625 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
626 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
627 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
628 | |
629 /* hbox for the table, and to give it some spacing on the left. */ | |
630 hbox = gtk_hbox_new(FALSE, 6); | |
631 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
632 | |
633 /* Setup the table we're going to use to lay stuff out. */ | |
634 table = gtk_table_new(2, 2, FALSE); | |
635 gtk_table_set_row_spacings(GTK_TABLE(table), 6); | |
636 gtk_table_set_col_spacings(GTK_TABLE(table), 6); | |
637 gtk_container_set_border_width(GTK_CONTAINER(table), 12); | |
638 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); | |
639 | |
640 /* Now the Buddy label */ | |
641 label = gtk_label_new(NULL); | |
642 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Buddy:")); | |
643 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
644 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); | |
645 | |
646 /* Now the Buddy drop-down entry field. */ | |
647 info->entry = gtk_combo_new(); | |
648 gtk_combo_set_case_sensitive(GTK_COMBO(info->entry), FALSE); | |
649 gtk_entry_set_activates_default( | |
650 GTK_ENTRY(GTK_COMBO(info->entry)->entry), TRUE); | |
651 | |
652 gtk_table_attach_defaults(GTK_TABLE(table), info->entry, 1, 2, 0, 1); | |
653 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->entry); | |
654 | |
655 /* Fill in the names. */ | |
656 gtk_combo_set_popdown_strings(GTK_COMBO(info->entry), | |
657 generate_invite_user_names(gc)); | |
658 | |
659 | |
660 /* Now the label for "Message" */ | |
661 label = gtk_label_new(NULL); | |
662 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Message:")); | |
663 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
664 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); | |
665 | |
666 | |
667 /* And finally, the Message entry field. */ | |
668 info->message = gtk_entry_new(); | |
669 gtk_entry_set_activates_default(GTK_ENTRY(info->message), TRUE); | |
670 | |
671 gtk_table_attach_defaults(GTK_TABLE(table), info->message, 1, 2, 1, 2); | |
672 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->message); | |
673 | |
674 /* Connect the signals. */ | |
675 g_signal_connect(G_OBJECT(invite_dialog), "response", | |
676 G_CALLBACK(do_invite), info); | |
677 } | |
678 | |
679 gtk_widget_show_all(invite_dialog); | |
680 | |
681 if (info != NULL) | |
682 gtk_widget_grab_focus(GTK_COMBO(info->entry)->entry); | |
683 } | |
684 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
685 static void |
7748 | 686 menu_new_conv_cb(gpointer data, guint action, GtkWidget *widget) |
687 { | |
688 show_im_dialog(); | |
689 } | |
690 | |
691 static void | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
692 menu_save_as_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
693 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
694 GaimConvWindow *win = (GaimConvWindow *)data; |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
695 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
696 save_convo(NULL, gaim_conv_window_get_active_conversation(win)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
697 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
698 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
699 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
700 menu_view_log_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
701 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
702 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
703 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
704 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
705 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
706 |
7431 | 707 gaim_gtk_log_show((char *)gaim_conversation_get_name(conv), gaim_conversation_get_account(conv)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
708 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
709 |
7295 | 710 struct _search { |
711 GaimGtkConversation *gtkconv; | |
712 GtkWidget *entry; | |
713 }; | |
714 | |
7929 | 715 static void do_search_cb(GtkWidget *widget, gint resp, struct _search *s) |
7295 | 716 { |
7929 | 717 switch (resp) { |
718 case GTK_RESPONSE_OK: | |
719 gtk_imhtml_search_find(GTK_IMHTML(s->gtkconv->imhtml), gtk_entry_get_text(GTK_ENTRY(s->entry))); | |
720 break; | |
721 | |
722 case GTK_RESPONSE_DELETE_EVENT: | |
723 case GTK_RESPONSE_CLOSE: | |
724 gtk_imhtml_search_clear(GTK_IMHTML(s->gtkconv->imhtml)); | |
725 gtk_widget_destroy(s->gtkconv->dialogs.search); | |
726 s->gtkconv->dialogs.search = NULL; | |
727 g_free(s); | |
728 break; | |
729 } | |
7295 | 730 } |
731 | |
732 static void | |
7751 | 733 menu_find_cb(gpointer data, guint action, GtkWidget *widget) |
7295 | 734 { |
735 GaimConvWindow *win = (GaimConvWindow *)data; | |
736 GaimConversation *conv = gaim_conv_window_get_active_conversation(win); | |
737 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); | |
738 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7929 | 739 GtkWidget *hbox; |
7295 | 740 GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG); |
7929 | 741 GtkWidget *label; |
7295 | 742 struct _search *s; |
743 | |
7798 | 744 if (gtkconv->dialogs.search) { |
745 gtk_window_present(GTK_WINDOW(gtkconv->dialogs.search)); | |
7295 | 746 return; |
7798 | 747 } |
7300
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
748 |
7295 | 749 s = g_malloc(sizeof(struct _search)); |
750 s->gtkconv = gtkconv; | |
7929 | 751 |
752 gtkconv->dialogs.search = gtk_dialog_new_with_buttons(_("Find"), | |
753 GTK_WINDOW(gtkwin->window), GTK_DIALOG_DESTROY_WITH_PARENT, | |
754 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, | |
755 GTK_STOCK_FIND, GTK_RESPONSE_OK, NULL); | |
756 gtk_dialog_set_default_response(GTK_DIALOG(gtkconv->dialogs.search), GTK_RESPONSE_OK); | |
757 g_signal_connect(G_OBJECT(gtkconv->dialogs.search), "response", | |
758 G_CALLBACK(do_search_cb), s); | |
759 | |
760 gtk_container_set_border_width(GTK_CONTAINER(gtkconv->dialogs.search), 6); | |
761 gtk_window_set_resizable(GTK_WINDOW(gtkconv->dialogs.search), FALSE); | |
762 gtk_dialog_set_has_separator(GTK_DIALOG(gtkconv->dialogs.search), FALSE); | |
763 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(gtkconv->dialogs.search)->vbox), 12); | |
764 gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(gtkconv->dialogs.search)->vbox), 6); | |
765 | |
766 hbox = gtk_hbox_new(FALSE, 12); | |
767 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(gtkconv->dialogs.search)->vbox), hbox); | |
768 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
769 | |
770 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
771 gtk_dialog_set_response_sensitive(GTK_DIALOG(gtkconv->dialogs.search), GTK_RESPONSE_OK, FALSE); | |
772 | |
773 label = gtk_label_new(NULL); | |
774 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Search for:")); | |
775 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
776 | |
777 s->entry = gtk_entry_new(); | |
778 gtk_entry_set_activates_default(GTK_ENTRY(s->entry), TRUE); | |
779 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(s->entry)); | |
780 g_signal_connect(G_OBJECT(s->entry), "changed", | |
781 G_CALLBACK(gaim_gtk_set_sensitive_if_input), | |
782 gtkconv->dialogs.search); | |
783 gtk_box_pack_start(GTK_BOX(hbox), s->entry, FALSE, FALSE, 0); | |
7300
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
784 |
7295 | 785 gtk_widget_show_all(gtkconv->dialogs.search); |
7929 | 786 gtk_widget_grab_focus(s->entry); |
7295 | 787 } |
788 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
789 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
790 menu_add_pounce_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
791 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
792 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
793 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
794 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
795 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
796 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
797 gaim_gtkpounce_dialog_show(gaim_conversation_get_account(conv), |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
798 gaim_conversation_get_name(conv), NULL); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
799 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
800 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
801 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
802 menu_insert_link_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
803 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
804 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
805 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
806 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
807 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
808 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
809 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
810 |
7927 | 811 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.link), |
812 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.link))); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
813 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
814 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
815 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
816 menu_insert_image_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
817 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
818 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
819 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
820 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
821 gtkconv = GAIM_GTK_CONVERSATION(gaim_conv_window_get_active_conversation(win)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
822 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
823 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.image), |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
824 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.image))); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
825 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
826 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
827 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
828 menu_alias_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
829 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
830 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
831 GaimConversation *conv; |
7879 | 832 GaimAccount *account; |
833 const char *name; | |
834 | |
835 conv = gaim_conv_window_get_active_conversation(win); | |
836 account = gaim_conversation_get_account(conv); | |
837 name = gaim_conversation_get_name(conv); | |
838 | |
839 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
840 GaimBuddy *b; | |
841 | |
842 b = gaim_find_buddy(account, name); | |
843 if (b != NULL) | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
844 alias_dialog_bud(b); |
7879 | 845 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
846 GaimChat *c; | |
847 | |
848 c = gaim_blist_find_chat(account, name); | |
849 if (c != NULL) | |
850 alias_dialog_blist_chat(c); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
851 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
852 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
853 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
854 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
855 menu_get_info_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
856 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
857 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
858 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
859 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
860 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
861 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
862 info_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
863 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
864 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
865 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
866 menu_invite_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
867 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
868 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
869 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
870 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
871 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
872 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
873 invite_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
874 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
875 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
876 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
877 menu_warn_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
878 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
879 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
880 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
881 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
882 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
883 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
884 warn_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
885 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
886 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
887 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
888 menu_block_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
889 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
890 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
891 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
892 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
893 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
894 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
895 block_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
896 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
897 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
898 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
899 menu_add_remove_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
900 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
901 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
902 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
903 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
904 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
905 |
7928 | 906 add_remove_cb(NULL, conv); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
907 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
908 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
909 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
910 menu_close_conv_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
911 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
912 GaimConvWindow *win = (GaimConvWindow *)data; |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
913 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
914 close_conv_cb(NULL, gaim_conv_window_get_active_conversation(win)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
915 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
916 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
917 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
918 menu_logging_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
919 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
920 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
921 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
922 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
923 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
924 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
925 if (conv == NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
926 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
927 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
928 gaim_conversation_set_logging(conv, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
929 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
930 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
931 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
932 static void |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
933 menu_toolbar_cb(gpointer data, guint action, GtkWidget *widget) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
934 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
935 GaimConvWindow *win = (GaimConvWindow *)data; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
936 GaimConversation *conv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
937 GaimGtkConversation *gtkconv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
938 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
939 conv = gaim_conv_window_get_active_conversation(win); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
940 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
941 if (conv == NULL) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
942 return; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
943 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
944 gtkconv = GAIM_GTK_CONVERSATION(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
945 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
946 gtkconv->show_formatting_toolbar = |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
947 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
948 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
949 if (gtkconv->show_formatting_toolbar) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
950 gtk_widget_show(gtkconv->toolbar.toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
951 else |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
952 gtk_widget_hide(gtkconv->toolbar.toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
953 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
954 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
955 static void |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
956 menu_sounds_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
957 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
958 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
959 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
960 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
961 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
962 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
963 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
964 if (!conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
965 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
966 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
967 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
968 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
969 gtkconv->make_sound = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
970 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
971 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
972 |
7961 | 973 static void |
974 chat_do_im(GaimConversation *conv, const char *who) | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
975 { |
7961 | 976 GaimPluginProtocolInfo *prpl_info = NULL; |
977 char *real_who; | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
978 GaimConversation *conv2; |
7961 | 979 GaimAccount *account; |
980 | |
981 account = gaim_conversation_get_account(conv); | |
982 | |
983 if(account && account->gc) | |
984 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl); | |
985 | |
986 if(prpl_info && prpl_info->get_cb_real_name) | |
987 real_who = prpl_info->get_cb_real_name(account->gc, | |
988 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); | |
989 else | |
990 real_who = g_strdup(who); | |
991 | |
992 if(!real_who) | |
993 return; | |
994 | |
995 conv2 = gaim_find_conversation_with_account(real_who, account); | |
996 | |
997 if (conv2 != NULL) | |
998 gaim_conv_window_show(gaim_conversation_get_window(conv2)); | |
999 else | |
1000 conv2 = gaim_conversation_new(GAIM_CONV_IM, account, real_who); | |
1001 | |
1002 g_free(real_who); | |
1003 } | |
1004 | |
1005 | |
1006 static void | |
1007 chat_im_button_cb(GtkWidget *widget, GaimConversation *conv) | |
1008 { | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1009 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1010 GaimGtkChatPane *gtkchat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1011 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1012 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1013 GtkTreeSelection *sel; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1014 const char *name; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1015 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1016 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1017 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1018 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1019 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1020 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1021 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1022 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1023 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
|
1024 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1025 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1026 |
7961 | 1027 chat_do_im(conv, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1028 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1029 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1030 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1031 ignore_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1032 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1033 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1034 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1035 GaimConvChat *chat; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1036 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1037 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1038 GtkTreeSelection *sel; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1039 const char *name; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1040 int pos; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1041 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1042 chat = GAIM_CONV_CHAT(conv); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1043 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1044 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1045 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1046 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1047 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1048 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1049 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1050 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
|
1051 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1052 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1053 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1054 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1055 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1056 pos = g_list_index(gaim_conv_chat_get_users(chat), name); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1057 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1058 if (gaim_conv_chat_is_user_ignored(chat, name)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1059 gaim_conv_chat_unignore(chat, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1060 else |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1061 gaim_conv_chat_ignore(chat, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1062 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1063 add_chat_buddy_common(conv, name, pos); |
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 |
7398 | 1067 menu_chat_im_cb(GtkWidget *w, GaimConversation *conv) |
1068 { | |
1069 const char *who = g_object_get_data(G_OBJECT(w), "user_data"); | |
1070 | |
1071 chat_do_im(conv, who); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1072 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1073 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1074 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1075 menu_chat_info_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1076 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1077 GaimPluginProtocolInfo *prpl_info = NULL; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1078 GaimConnection *gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1079 char *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1080 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1081 gc = gaim_conversation_get_gc(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1082 who = g_object_get_data(G_OBJECT(w), "user_data"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1083 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1084 if (gc != NULL) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1085 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1086 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1087 /* |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1088 * If there are special needs for getting info on users in |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1089 * buddy chat "rooms"... |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1090 */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1091 if (prpl_info->get_cb_info != NULL) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1092 prpl_info->get_cb_info(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1093 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1094 prpl_info->get_info(gc, who); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1095 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1096 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1097 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1098 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1099 menu_chat_get_away_cb(GtkWidget *w, GaimConversation *conv) |
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 GaimPluginProtocolInfo *prpl_info = NULL; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1102 GaimConnection *gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1103 char *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1104 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1105 gc = gaim_conversation_get_gc(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1106 who = g_object_get_data(G_OBJECT(w), "user_data"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1107 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1108 if (gc != NULL) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1109 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1110 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1111 /* |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1112 * 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
|
1113 */ |
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 if (prpl_info->get_cb_away != NULL) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1116 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
|
1117 } |
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 |
7928 | 1121 menu_chat_add_remove_cb(GtkWidget *w, GaimConversation *conv) |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1122 { |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1123 GaimAccount *account; |
6695 | 1124 GaimBuddy *b; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1125 char *name; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1126 |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1127 account = gaim_conversation_get_account(conv); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1128 name = g_object_get_data(G_OBJECT(w), "user_data"); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1129 b = gaim_find_buddy(account, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1130 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1131 if (b != NULL) |
5975 | 1132 show_confirm_del(b); |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1133 else if (account != NULL && gaim_account_is_connected(account)) |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1134 gaim_blist_request_add_buddy(account, name, NULL, NULL); |
5908
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 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1137 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1138 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1139 static gint |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1140 right_click_chat_cb(GtkWidget *widget, GdkEventButton *event, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1141 GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1142 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1143 GaimPluginProtocolInfo *prpl_info = NULL; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1144 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1145 GaimGtkChatPane *gtkchat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1146 GaimConnection *gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1147 GaimAccount *account; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1148 GtkTreePath *path; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1149 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1150 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1151 GtkTreeViewColumn *column; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1152 gchar *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1153 int x, y; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1154 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1155 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1156 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1157 account = gaim_conversation_get_account(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1158 gc = account->gc; |
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 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1161 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1162 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
|
1163 event->x, event->y, &path, &column, &x, &y); |
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 if (path == NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1166 return FALSE; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1167 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1168 if (gc != NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1169 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1170 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1171 gtk_tree_selection_select_path(GTK_TREE_SELECTION( |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1172 gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list))), path); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1173 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1174 gtk_tree_model_get_iter(GTK_TREE_MODEL(model), &iter, path); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1175 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
|
1176 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1177 if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) { |
7398 | 1178 chat_do_im(conv, who); |
1179 } else if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1180 static GtkWidget *menu = NULL; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1181 GtkWidget *button; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1182 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1183 /* |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1184 * 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
|
1185 * thus freeing-up the memory it occupied. |
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 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1188 if (menu) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1189 gtk_widget_destroy(menu); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1190 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1191 menu = gtk_menu_new(); |
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 button = gtk_menu_item_new_with_label(_("IM")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1194 g_signal_connect(G_OBJECT(button), "activate", |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1195 G_CALLBACK(menu_chat_im_cb), conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1196 g_object_set_data(G_OBJECT(button), "user_data", who); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1197 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1198 gtk_widget_show(button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1199 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1200 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
|
1201 button = gtk_menu_item_new_with_label(_("Un-Ignore")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1202 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1203 button = gtk_menu_item_new_with_label(_("Ignore")); |
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 g_signal_connect(G_OBJECT(button), "activate", |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1206 G_CALLBACK(ignore_cb), conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1207 g_object_set_data(G_OBJECT(button), "user_data", who); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1208 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1209 gtk_widget_show(button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1210 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1211 if (gc && prpl_info->get_info) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1212 button = gtk_menu_item_new_with_label(_("Info")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1213 g_signal_connect(G_OBJECT(button), "activate", |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1214 G_CALLBACK(menu_chat_info_cb), conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1215 g_object_set_data(G_OBJECT(button), "user_data", who); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1216 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1217 gtk_widget_show(button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1218 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1219 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1220 if (gc && prpl_info->get_cb_away) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1221 button = gtk_menu_item_new_with_label(_("Get Away Msg")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1222 g_signal_connect(G_OBJECT(button), "activate", |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1223 G_CALLBACK(menu_chat_get_away_cb), conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1224 g_object_set_data(G_OBJECT(button), "user_data", who); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1225 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1226 gtk_widget_show(button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1227 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1228 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1229 /* Added by Jonas <jonas@birme.se> */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1230 if (gc) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1231 if (gaim_find_buddy(gc->account, who)) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1232 button = gtk_menu_item_new_with_label(_("Remove")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1233 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1234 button = gtk_menu_item_new_with_label(_("Add")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1235 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1236 g_signal_connect(G_OBJECT(button), "activate", |
7928 | 1237 G_CALLBACK(menu_chat_add_remove_cb), conv); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1238 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1239 g_object_set_data(G_OBJECT(button), "user_data", who); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1240 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1241 gtk_widget_show(button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1242 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1243 /* End Jonas */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1244 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1245 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1246 event->button, event->time); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1247 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1248 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1249 return TRUE; |
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 |
4359 | 1252 static gboolean |
1253 entry_key_pressed_cb_2(GtkWidget *entry, GdkEventKey *event, gpointer data) | |
1254 { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1255 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1256 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1257 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1258 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1259 |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1260 conv = (GaimConversation *)data; |
4359 | 1261 gtkconv = GAIM_GTK_CONVERSATION(conv); |
1262 win = gaim_conversation_get_window(conv); | |
4362 | 1263 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 1264 |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
1265 if (event->keyval == GDK_Page_Up) { |
4359 | 1266 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); |
1267 | |
1268 if (!(event->state & GDK_CONTROL_MASK)) | |
1269 gtk_imhtml_page_up(GTK_IMHTML(gtkconv->imhtml)); | |
1270 } | |
1271 else if (event->keyval == GDK_Page_Down) { | |
1272 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1273 | |
1274 if (!(event->state & GDK_CONTROL_MASK)) | |
1275 gtk_imhtml_page_down(GTK_IMHTML(gtkconv->imhtml)); | |
1276 } | |
6033 | 1277 else if (event->keyval == GDK_F2) { |
1278 | |
1279 gaim_prefs_set_bool("/gaim/gtk/conversations/show_timestamps", | |
1280 !gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); | |
4359 | 1281 } |
1282 else if (event->keyval == GDK_Return || event->keyval == GDK_KP_Enter) { | |
1283 if ((event->state & GDK_CONTROL_MASK) && | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1284 gaim_prefs_get_bool("/gaim/gtk/conversations/ctrl_enter_sends")) { |
4359 | 1285 |
1286 send_cb(NULL, conv); | |
1287 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1288 | |
1289 return TRUE; | |
1290 } | |
1291 else if (!(event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK)) && | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1292 gaim_prefs_get_bool("/gaim/gtk/conversations/enter_sends")) { |
4359 | 1293 |
1294 send_cb(NULL, conv); | |
1295 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1296 | |
1297 return TRUE; | |
1298 } | |
1299 | |
1300 return FALSE; | |
1301 } | |
6014 | 1302 else if ((event->state & GDK_CONTROL_MASK) && (event->keyval == 'm' || |
1303 event->keyval == 'M')) { | |
4359 | 1304 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); |
1305 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, "\n", 1); | |
1306 } | |
1307 else if (event->state & GDK_CONTROL_MASK) { | |
1308 switch (event->keyval) { | |
1309 case GDK_Up: | |
1310 if (!conv->send_history) | |
1311 break; | |
1312 | |
1313 if (!conv->send_history->prev) { | |
1314 GtkTextIter start, end; | |
1315 | |
1316 if (conv->send_history->data) | |
1317 g_free(conv->send_history->data); | |
1318 | |
1319 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, | |
1320 &start); | |
1321 gtk_text_buffer_get_end_iter(gtkconv->entry_buffer, &end); | |
1322 | |
1323 conv->send_history->data = | |
1324 gtk_text_buffer_get_text(gtkconv->entry_buffer, | |
1325 &start, &end, FALSE); | |
1326 } | |
1327 | |
1328 if (conv->send_history->next && | |
1329 conv->send_history->next->data) { | |
1330 | |
1331 conv->send_history = conv->send_history->next; | |
7801 | 1332 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); |
1333 gtk_imhtml_append_text_with_images(GTK_IMHTML(gtkconv->entry), conv->send_history->data, 0, NULL); | |
4359 | 1334 } |
1335 | |
1336 break; | |
1337 | |
1338 case GDK_Down: | |
1339 if (!conv->send_history) | |
1340 break; | |
1341 | |
1342 if (conv->send_history->prev) { | |
1343 conv->send_history = conv->send_history->prev; | |
1344 | |
7801 | 1345 if (conv->send_history->data) { |
1346 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); | |
1347 gtk_imhtml_append_text_with_images(GTK_IMHTML(gtkconv->entry), conv->send_history->data, 0, NULL); | |
1348 } | |
4359 | 1349 } |
1350 | |
1351 break; | |
1352 } | |
1353 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1354 if (gaim_prefs_get_bool("/gaim/gtk/conversations/html_shortcuts")) { |
4359 | 1355 switch (event->keyval) { |
1356 case 'i': | |
1357 case 'I': | |
4685 | 1358 set_toggle(gtkconv->toolbar.italic, |
4359 | 1359 !gtk_toggle_button_get_active( |
1360 GTK_TOGGLE_BUTTON(gtkconv->toolbar.italic))); | |
1361 | |
1362 g_signal_stop_emission_by_name(G_OBJECT(entry), | |
1363 "key_press_event"); | |
1364 break; | |
1365 | |
1366 case 'u': /* ctrl-u is GDK_Clear, which clears the line. */ | |
1367 case 'U': | |
4685 | 1368 set_toggle(gtkconv->toolbar.underline, |
4359 | 1369 !gtk_toggle_button_get_active( |
1370 GTK_TOGGLE_BUTTON(gtkconv->toolbar.underline))); | |
1371 | |
1372 g_signal_stop_emission_by_name(G_OBJECT(entry), | |
1373 "key_press_event"); | |
1374 break; | |
1375 | |
1376 case 'b': /* ctrl-b is GDK_Left, which moves backwards. */ | |
1377 case 'B': | |
4685 | 1378 set_toggle(gtkconv->toolbar.bold, |
4359 | 1379 !gtk_toggle_button_get_active( |
1380 GTK_TOGGLE_BUTTON(gtkconv->toolbar.bold))); | |
1381 | |
1382 g_signal_stop_emission_by_name(G_OBJECT(entry), | |
1383 "key_press_event"); | |
1384 break; | |
6014 | 1385 |
4359 | 1386 case '-': |
6015 | 1387 set_toggle(gtkconv->toolbar.smaller_size, |
1388 !gtk_toggle_button_get_active( | |
1389 GTK_TOGGLE_BUTTON(gtkconv->toolbar.smaller_size))); | |
6014 | 1390 |
4359 | 1391 g_signal_stop_emission_by_name(G_OBJECT(entry), |
1392 "key_press_event"); | |
1393 break; | |
1394 | |
1395 case '=': | |
1396 case '+': | |
6015 | 1397 set_toggle(gtkconv->toolbar.larger_size, |
1398 !gtk_toggle_button_get_active( | |
1399 GTK_TOGGLE_BUTTON(gtkconv->toolbar.larger_size))); | |
4359 | 1400 |
1401 g_signal_stop_emission_by_name(G_OBJECT(entry), | |
1402 "key_press_event"); | |
1403 break; | |
1404 | |
1405 case '0': | |
7740 | 1406 /*set_toggle(gtkconv->toolbar.normal_size, |
4685 | 1407 !gtk_toggle_button_get_active( |
1408 GTK_TOGGLE_BUTTON(gtkconv->toolbar.normal_size))); | |
4359 | 1409 |
1410 g_signal_stop_emission_by_name(G_OBJECT(entry), | |
7740 | 1411 "key_press_event"); */ |
4359 | 1412 break; |
1413 | |
1414 case 'f': | |
1415 case 'F': | |
4685 | 1416 set_toggle(gtkconv->toolbar.font, |
4359 | 1417 !gtk_toggle_button_get_active( |
4685 | 1418 GTK_TOGGLE_BUTTON(gtkconv->toolbar.font))); |
4359 | 1419 |
1420 g_signal_stop_emission_by_name(G_OBJECT(entry), | |
1421 "key_press_event"); | |
1422 break; | |
1423 } | |
1424 } | |
1425 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1426 if (gaim_prefs_get_bool("/gaim/gtk/conversations/smiley_shortcuts")) { |
4359 | 1427 char buf[7]; |
1428 | |
1429 *buf = '\0'; | |
1430 | |
1431 switch (event->keyval) { | |
1432 case '1': strcpy(buf, ":-)"); break; | |
1433 case '2': strcpy(buf, ":-("); break; | |
1434 case '3': strcpy(buf, ";-)"); break; | |
1435 case '4': strcpy(buf, ":-P"); break; | |
1436 case '5': strcpy(buf, "=-O"); break; | |
1437 case '6': strcpy(buf, ":-*"); break; | |
1438 case '7': strcpy(buf, ">:o"); break; | |
1439 case '8': strcpy(buf, "8-)"); break; | |
1440 case '!': strcpy(buf, ":-$"); break; | |
1441 case '@': strcpy(buf, ":-!"); break; | |
1442 case '#': strcpy(buf, ":-["); break; | |
1443 case '$': strcpy(buf, "O:-)"); break; | |
1444 case '%': strcpy(buf, ":-/"); break; | |
1445 case '^': strcpy(buf, ":'("); break; | |
1446 case '&': strcpy(buf, ":-X"); break; | |
1447 case '*': strcpy(buf, ":-D"); break; | |
1448 default: break; | |
1449 } | |
1450 | |
1451 if (*buf) { | |
1452 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, | |
1453 buf, -1); | |
1454 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1455 } | |
1456 } | |
1457 | |
1458 if (event->keyval == 'l') { | |
1459 gtk_imhtml_clear(GTK_IMHTML(gtkconv->imhtml)); | |
1460 g_string_free(conv->history, TRUE); | |
1461 conv->history = g_string_new(""); | |
1462 } | |
1463 else if (event->keyval == 'z') { | |
1464 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
5133 | 1465 |
1466 gtk_window_iconify(GTK_WINDOW(gtkwin->window)); | |
4359 | 1467 } |
1468 else if (event->keyval == '[') { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1469 gaim_conv_window_switch_conversation(win, |
4359 | 1470 gaim_conversation_get_index(conv) - 1); |
1471 | |
1472 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1473 } | |
1474 else if (event->keyval == ']') { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1475 gaim_conv_window_switch_conversation(win, |
4359 | 1476 gaim_conversation_get_index(conv) + 1); |
1477 | |
1478 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1479 } | |
1480 else if (event->keyval == GDK_Tab) { | |
1481 move_next_tab(conv); | |
1482 | |
1483 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1484 | |
1485 return TRUE; | |
1486 } | |
1487 } | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1488 else if (event->keyval == GDK_Tab && |
4359 | 1489 gaim_conversation_get_type(conv) == GAIM_CONV_CHAT && |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1490 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/tab_completion")) { |
4359 | 1491 |
1492 tab_complete(conv); | |
1493 | |
1494 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1495 | |
1496 return TRUE; | |
1497 } | |
1498 else if ((event->state & GDK_MOD1_MASK) && | |
1499 event->keyval > '0' && event->keyval <= '9') { | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1500 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1501 gaim_conv_window_switch_conversation(win, event->keyval - '1'); |
4359 | 1502 |
1503 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1504 } | |
1505 | |
1506 return FALSE; | |
1507 } | |
1508 | |
1509 /* | |
1510 * NOTE: | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1511 * 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
|
1512 * further. I have no idea *why* we need this, but we do ... It |
4359 | 1513 * 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
|
1514 * going all the way down to the notebook. I suspect a bug in |
4359 | 1515 * GtkTextView, but I'm not ready to point any fingers yet. |
1516 */ | |
1517 static gboolean | |
1518 entry_stop_rclick_cb(GtkWidget *widget, GdkEventButton *event, gpointer data) | |
1519 { | |
1520 if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { | |
1521 /* Right single click */ | |
1522 g_signal_stop_emission_by_name(G_OBJECT(widget), "button_press_event"); | |
1523 | |
1524 return TRUE; | |
1525 } | |
1526 | |
1527 return FALSE; | |
1528 } | |
1529 | |
6057 | 1530 static gboolean |
1531 refocus_entry_cb(GtkWidget *widget, GdkEventButton *event, gpointer data) | |
1532 { | |
1533 GaimGtkConversation *gtkconv = data; | |
1534 | |
1535 gtk_widget_grab_focus(gtkconv->entry); | |
1536 | |
1537 return FALSE; | |
1538 } | |
1539 | |
4359 | 1540 static void |
4673 | 1541 menu_conv_sel_send_cb(GObject *m, gpointer data) |
4359 | 1542 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1543 GaimConvWindow *win = g_object_get_data(m, "user_data"); |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
1544 GaimAccount *account = g_object_get_data(m, "gaim_account"); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1545 GaimConversation *conv; |
4359 | 1546 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1547 conv = gaim_conv_window_get_active_conversation(win); |
4359 | 1548 |
4491 | 1549 gaim_conversation_set_account(conv, account); |
4359 | 1550 } |
1551 | |
1552 static void | |
1553 insert_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *position, | |
1554 gchar *new_text, gint new_text_length, gpointer user_data) | |
1555 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1556 GaimConversation *conv = (GaimConversation *)user_data; |
4359 | 1557 |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1558 g_return_if_fail(conv != NULL); |
4359 | 1559 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1560 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) |
4359 | 1561 return; |
1562 | |
1563 got_typing_keypress(conv, (gtk_text_iter_is_start(position) && | |
1564 gtk_text_iter_is_end(position))); | |
1565 } | |
1566 | |
1567 static void | |
1568 delete_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *start_pos, | |
1569 GtkTextIter *end_pos, gpointer user_data) | |
1570 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1571 GaimConversation *conv = (GaimConversation *)user_data; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1572 GaimConvIm *im; |
4359 | 1573 |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1574 g_return_if_fail(conv != NULL); |
4359 | 1575 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1576 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) |
4359 | 1577 return; |
1578 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1579 im = GAIM_CONV_IM(conv); |
4359 | 1580 |
1581 if (gtk_text_iter_is_start(start_pos) && gtk_text_iter_is_end(end_pos)) { | |
1582 | |
1583 /* We deleted all the text, so turn off typing. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1584 if (gaim_conv_im_get_type_again_timeout(im)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1585 gaim_conv_im_stop_type_again_timeout(im); |
4359 | 1586 |
1587 serv_send_typing(gaim_conversation_get_gc(conv), | |
6695 | 1588 gaim_conversation_get_name(conv), |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
1589 GAIM_NOT_TYPING); |
4359 | 1590 } |
1591 else { | |
1592 /* We're deleting, but not all of it, so it counts as typing. */ | |
1593 got_typing_keypress(conv, FALSE); | |
1594 } | |
1595 } | |
1596 | |
1597 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1598 notebook_init_grab(GaimGtkWindow *gtkwin, GtkWidget *widget) |
4359 | 1599 { |
1600 static GdkCursor *cursor = NULL; | |
1601 | |
1602 gtkwin->in_drag = TRUE; | |
1603 | |
1604 if (gtkwin->drag_leave_signal) { | |
1605 g_signal_handler_disconnect(G_OBJECT(widget), | |
1606 gtkwin->drag_leave_signal); | |
1607 | |
1608 gtkwin->drag_leave_signal = 0; | |
1609 } | |
1610 | |
1611 if (cursor == NULL) | |
1612 cursor = gdk_cursor_new(GDK_FLEUR); | |
1613 | |
1614 /* Grab the pointer */ | |
1615 gtk_grab_add(gtkwin->notebook); | |
5114
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1616 #ifndef _WIN32 |
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1617 /* 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
|
1618 always be true after a button press. */ |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1619 if (!gdk_pointer_is_grabbed()) |
5114
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1620 #endif |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1621 gdk_pointer_grab(gtkwin->notebook->window, FALSE, |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1622 GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1623 NULL, cursor, GDK_CURRENT_TIME); |
4359 | 1624 } |
1625 | |
1626 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1627 notebook_motion_cb(GtkWidget *widget, GdkEventButton *e, GaimConvWindow *win) |
4359 | 1628 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1629 GaimGtkWindow *gtkwin; |
4359 | 1630 |
1631 gtkwin = GAIM_GTK_WINDOW(win); | |
1632 | |
1633 /* | |
1634 * Make sure the user moved the mouse far enough for the | |
1635 * drag to be initiated. | |
1636 */ | |
1637 if (gtkwin->in_predrag) { | |
1638 if (e->x_root < gtkwin->drag_min_x || | |
1639 e->x_root >= gtkwin->drag_max_x || | |
1640 e->y_root < gtkwin->drag_min_y || | |
1641 e->y_root >= gtkwin->drag_max_y) { | |
1642 | |
1643 gtkwin->in_predrag = FALSE; | |
1644 notebook_init_grab(gtkwin, widget); | |
1645 } | |
1646 } | |
1647 else { /* Otherwise, draw the arrows. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1648 GaimConvWindow *dest_win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1649 GaimGtkWindow *dest_gtkwin; |
4359 | 1650 GtkNotebook *dest_notebook; |
1651 GtkWidget *tab, *last_vis_tab = NULL; | |
1652 gint nb_x, nb_y, page_num, i, last_vis_tab_loc = -1; | |
1653 gint arrow1_x, arrow1_y, arrow2_x, arrow2_y; | |
1654 gboolean horiz_tabs = FALSE, tab_found = FALSE; | |
1655 GList *l; | |
1656 | |
1657 /* Get the window that the cursor is over. */ | |
1658 dest_win = gaim_gtkwin_get_at_xy(e->x_root, e->y_root); | |
1659 | |
1660 if (dest_win == NULL) { | |
1661 dnd_hints_hide_all(); | |
1662 | |
1663 return TRUE; | |
1664 } | |
1665 | |
1666 dest_gtkwin = GAIM_GTK_WINDOW(dest_win); | |
1667 | |
1668 dest_notebook = GTK_NOTEBOOK(dest_gtkwin->notebook); | |
1669 | |
1670 gdk_window_get_origin(GTK_WIDGET(dest_notebook)->window, &nb_x, &nb_y); | |
1671 | |
1672 arrow1_x = arrow2_x = nb_x; | |
1673 arrow1_y = arrow2_y = nb_y; | |
1674 | |
1675 page_num = gaim_gtkconv_get_dest_tab_at_xy(dest_win, | |
1676 e->x_root, e->y_root); | |
1677 | |
1678 if (gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_TOP || | |
1679 gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_BOTTOM) { | |
1680 | |
1681 horiz_tabs = TRUE; | |
1682 } | |
1683 | |
1684 /* Find out where to put the arrows. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1685 for (l = gaim_conv_window_get_conversations(dest_win), i = 0; |
4359 | 1686 l != NULL; |
1687 l = l->next, i++) { | |
1688 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1689 GaimConversation *conv = l->data; |
4359 | 1690 |
1691 tab = GAIM_GTK_CONVERSATION(conv)->tabby; | |
1692 | |
1693 /* | |
1694 * If this is the correct tab, record the positions | |
1695 * for the arrows. | |
1696 */ | |
1697 if (i == page_num) { | |
1698 if (horiz_tabs) { | |
1699 arrow1_x = arrow2_x = nb_x + tab->allocation.x; | |
1700 arrow1_y = nb_y + tab->allocation.y; | |
1701 arrow2_y = nb_y + tab->allocation.y + | |
1702 tab->allocation.height; | |
1703 } | |
1704 else { | |
1705 arrow1_x = nb_x + tab->allocation.x; | |
1706 arrow2_x = nb_x + tab->allocation.x + | |
1707 tab->allocation.width; | |
1708 arrow1_y = arrow2_y = nb_y + tab->allocation.y; | |
1709 } | |
1710 | |
1711 tab_found = TRUE; | |
1712 break; | |
1713 } | |
1714 else { /* Keep track of the right-most tab that we see. */ | |
1715 if (horiz_tabs && tab->allocation.x > last_vis_tab_loc) { | |
1716 last_vis_tab = tab; | |
1717 last_vis_tab_loc = tab->allocation.x; | |
1718 } | |
1719 else if (!horiz_tabs && tab->allocation.y > last_vis_tab_loc) { | |
1720 last_vis_tab = tab; | |
1721 last_vis_tab_loc = tab->allocation.y; | |
1722 } | |
1723 } | |
1724 } | |
1725 | |
1726 /* | |
1727 * If we didn't find the tab, then we'll just place the | |
1728 * arrows to the right/bottom of the last visible tab. | |
1729 */ | |
1730 if (!tab_found && last_vis_tab) { | |
1731 if (horiz_tabs) { | |
1732 arrow1_x = arrow2_x = nb_x + last_vis_tab->allocation.x + | |
1733 last_vis_tab->allocation.width; | |
1734 arrow1_y = nb_y + last_vis_tab->allocation.y; | |
1735 arrow2_y = nb_y + last_vis_tab->allocation.y + | |
1736 last_vis_tab->allocation.height; | |
1737 } | |
1738 else { | |
1739 arrow1_x = nb_x + last_vis_tab->allocation.x; | |
1740 arrow2_x = nb_x + last_vis_tab->allocation.x + | |
1741 last_vis_tab->allocation.width; | |
1742 arrow1_y = arrow2_y = nb_y + last_vis_tab->allocation.y + | |
1743 last_vis_tab->allocation.height; | |
1744 } | |
1745 } | |
1746 | |
1747 if (horiz_tabs) { | |
1748 dnd_hints_show(HINT_ARROW_DOWN, arrow1_x, arrow1_y); | |
1749 dnd_hints_show(HINT_ARROW_UP, arrow2_x, arrow2_y); | |
1750 } | |
1751 else { | |
1752 dnd_hints_show(HINT_ARROW_RIGHT, arrow1_x, arrow1_y); | |
1753 dnd_hints_show(HINT_ARROW_LEFT, arrow2_x, arrow2_y); | |
1754 } | |
1755 } | |
1756 | |
1757 return TRUE; | |
1758 } | |
1759 | |
1760 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1761 notebook_leave_cb(GtkWidget *widget, GdkEventCrossing *e, GaimConvWindow *win) |
4359 | 1762 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1763 GaimGtkWindow *gtkwin; |
4359 | 1764 |
1765 gtkwin = GAIM_GTK_WINDOW(win); | |
1766 | |
1767 if (gtkwin->in_drag) | |
1768 return FALSE; | |
1769 | |
1770 if (e->x_root < gtkwin->drag_min_x || | |
1771 e->x_root >= gtkwin->drag_max_x || | |
1772 e->y_root < gtkwin->drag_min_y || | |
1773 e->y_root >= gtkwin->drag_max_y) { | |
1774 | |
1775 gtkwin->in_predrag = FALSE; | |
1776 notebook_init_grab(gtkwin, widget); | |
1777 } | |
1778 | |
1779 return TRUE; | |
1780 } | |
1781 | |
1782 /* | |
1783 * THANK YOU GALEON! | |
1784 */ | |
1785 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1786 notebook_press_cb(GtkWidget *widget, GdkEventButton *e, GaimConvWindow *win) |
4359 | 1787 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1788 GaimGtkWindow *gtkwin; |
4359 | 1789 gint nb_x, nb_y, x_rel, y_rel; |
1790 GList *l; | |
1791 int tab_clicked; | |
1792 | |
1793 if (e->button != 1 || e->type != GDK_BUTTON_PRESS) | |
1794 return FALSE; | |
1795 | |
1796 gtkwin = GAIM_GTK_WINDOW(win); | |
1797 | |
1798 if (gtkwin->in_drag) { | |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1799 gaim_debug(GAIM_DEBUG_WARNING, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1800 "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
|
1801 return TRUE; |
4359 | 1802 } |
1803 | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1804 /* |
4359 | 1805 * Make sure a tab was actually clicked. The arrow buttons |
1806 * mess things up. | |
1807 */ | |
1808 tab_clicked = gaim_gtkconv_get_tab_at_xy(win, e->x_root, e->y_root); | |
1809 | |
1810 if (tab_clicked == -1) | |
1811 return FALSE; | |
1812 | |
1813 /* | |
1814 * Get the relative position of the press event, with regards to | |
1815 * the position of the notebook. | |
1816 */ | |
1817 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
1818 | |
1819 x_rel = e->x_root - nb_x; | |
1820 y_rel = e->y_root - nb_y; | |
1821 | |
1822 /* Reset the min/max x/y */ | |
1823 gtkwin->drag_min_x = 0; | |
1824 gtkwin->drag_min_y = 0; | |
1825 gtkwin->drag_max_x = 0; | |
1826 gtkwin->drag_max_y = 0; | |
1827 | |
1828 /* Find out which tab was dragged. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1829 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
|
1830 GaimConversation *conv = l->data; |
4359 | 1831 GtkWidget *tab = GAIM_GTK_CONVERSATION(conv)->tabby; |
1832 | |
1833 if (!GTK_WIDGET_VISIBLE(tab)) | |
1834 continue; | |
1835 | |
1836 if (tab->allocation.x > x_rel || tab->allocation.y > y_rel) | |
1837 break; | |
1838 | |
1839 /* Save the borders of the tab. */ | |
1840 gtkwin->drag_min_x = tab->allocation.x + nb_x; | |
1841 gtkwin->drag_min_y = tab->allocation.y + nb_y; | |
1842 gtkwin->drag_max_x = tab->allocation.width + gtkwin->drag_min_x; | |
1843 gtkwin->drag_max_y = tab->allocation.height + gtkwin->drag_min_y; | |
1844 } | |
1845 | |
1846 /* Make sure the click occurred in the tab. */ | |
1847 if (e->x_root < gtkwin->drag_min_x || | |
1848 e->x_root >= gtkwin->drag_max_x || | |
1849 e->y_root < gtkwin->drag_min_y || | |
1850 e->y_root >= gtkwin->drag_max_y) { | |
1851 | |
1852 return FALSE; | |
1853 } | |
1854 | |
1855 gtkwin->in_predrag = TRUE; | |
1856 | |
1857 /* Connect the new motion signals. */ | |
1858 gtkwin->drag_motion_signal = | |
1859 g_signal_connect(G_OBJECT(widget), "motion_notify_event", | |
1860 G_CALLBACK(notebook_motion_cb), win); | |
1861 | |
1862 gtkwin->drag_leave_signal = | |
1863 g_signal_connect(G_OBJECT(widget), "leave_notify_event", | |
1864 G_CALLBACK(notebook_leave_cb), win); | |
1865 | |
1866 return FALSE; | |
1867 } | |
1868 | |
1869 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1870 notebook_release_cb(GtkWidget *widget, GdkEventButton *e, GaimConvWindow *win) |
4359 | 1871 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1872 GaimConvWindow *dest_win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1873 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1874 GaimGtkWindow *dest_gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1875 GaimConversation *conv; |
4359 | 1876 GtkNotebook *dest_notebook; |
1877 gint dest_page_num; | |
1878 | |
1879 /* | |
1880 * Don't check to make sure that the event's window matches the | |
1881 * widget's, because we may be getting an event passed on from the | |
1882 * close button. | |
1883 */ | |
1884 if (e->button != 1 && e->type != GDK_BUTTON_RELEASE) | |
1885 return FALSE; | |
1886 | |
1887 if (gdk_pointer_is_grabbed()) { | |
1888 gdk_pointer_ungrab(GDK_CURRENT_TIME); | |
1889 gtk_grab_remove(widget); | |
1890 } | |
1891 | |
1892 gtkwin = GAIM_GTK_WINDOW(win); | |
1893 | |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1894 if (!gtkwin->in_predrag && !gtkwin->in_drag) |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1895 return FALSE; |
4359 | 1896 |
1897 /* Disconnect the motion signal. */ | |
1898 if (gtkwin->drag_motion_signal) { | |
1899 g_signal_handler_disconnect(G_OBJECT(widget), | |
1900 gtkwin->drag_motion_signal); | |
1901 | |
1902 gtkwin->drag_motion_signal = 0; | |
1903 } | |
1904 | |
1905 /* | |
1906 * If we're in a pre-drag, we'll also need to disconnect the leave | |
1907 * signal. | |
1908 */ | |
1909 if (gtkwin->in_predrag) { | |
1910 gtkwin->in_predrag = FALSE; | |
1911 | |
1912 if (gtkwin->drag_leave_signal) { | |
1913 g_signal_handler_disconnect(G_OBJECT(widget), | |
1914 gtkwin->drag_leave_signal); | |
1915 | |
1916 gtkwin->drag_leave_signal = 0; | |
1917 } | |
1918 } | |
1919 | |
1920 /* If we're not in drag... */ | |
1921 /* We're perfectly normal people! */ | |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1922 if (!gtkwin->in_drag) |
4359 | 1923 return FALSE; |
1924 | |
1925 gtkwin->in_drag = FALSE; | |
1926 | |
1927 dnd_hints_hide_all(); | |
1928 | |
4369
7e1fb422e5fd
[gaim-migrate @ 4635]
Christian Hammond <chipx86@chipx86.com>
parents:
4368
diff
changeset
|
1929 dest_win = gaim_gtkwin_get_at_xy(e->x_root, e->y_root); |
4359 | 1930 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1931 conv = gaim_conv_window_get_active_conversation(win); |
4359 | 1932 |
1933 if (dest_win == NULL) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1934 if (gaim_conv_window_get_conversation_count(win) < 2) |
4359 | 1935 return FALSE; |
1936 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1937 if (gaim_conv_window_get_conversation_count(win) > 1) { |
4359 | 1938 /* Make a new window to stick this to. */ |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1939 GaimConvWindow *new_win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1940 GaimGtkWindow *new_gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1941 GaimGtkConversation *gtkconv; |
4748
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1942 gint win_width, win_height; |
5121 | 1943 |
1944 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4359 | 1945 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1946 new_win = gaim_conv_window_new(); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1947 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1948 gaim_conv_window_add_conversation(new_win, |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1949 gaim_conv_window_remove_conversation(win, |
5139
d0182ae31ab8
[gaim-migrate @ 5503]
Christian Hammond <chipx86@chipx86.com>
parents:
5133
diff
changeset
|
1950 gaim_conversation_get_index(conv))); |
5121 | 1951 |
4748
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1952 new_gtkwin = GAIM_GTK_WINDOW(new_win); |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1953 |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1954 gtk_window_get_size(GTK_WINDOW(new_gtkwin->window), |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1955 &win_width, &win_height); |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1956 |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1957 gtk_window_move(GTK_WINDOW(new_gtkwin->window), |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1958 e->x_root - (win_width / 2), |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1959 e->y_root - (win_height / 2)); |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1960 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1961 gaim_conv_window_show(new_win); |
4359 | 1962 } |
1963 | |
1964 return TRUE; | |
1965 } | |
1966 | |
4369
7e1fb422e5fd
[gaim-migrate @ 4635]
Christian Hammond <chipx86@chipx86.com>
parents:
4368
diff
changeset
|
1967 dest_gtkwin = GAIM_GTK_WINDOW(dest_win); |
7e1fb422e5fd
[gaim-migrate @ 4635]
Christian Hammond <chipx86@chipx86.com>
parents:
4368
diff
changeset
|
1968 |
4359 | 1969 /* Get the destination notebook. */ |
1970 dest_notebook = GTK_NOTEBOOK(gtkwin->notebook); | |
1971 | |
1972 /* Get the destination page number. */ | |
1973 dest_page_num = gaim_gtkconv_get_dest_tab_at_xy(dest_win, | |
7143 | 1974 e->x_root, e->y_root); |
4359 | 1975 |
1976 if (win == dest_win) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1977 gaim_conv_window_move_conversation(win, |
4359 | 1978 gaim_conversation_get_index(conv), dest_page_num); |
1979 } | |
1980 else { | |
1981 size_t pos; | |
1982 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1983 gaim_conv_window_remove_conversation(win, |
4359 | 1984 gaim_conversation_get_index(conv)); |
1985 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1986 pos = gaim_conv_window_add_conversation(dest_win, conv); |
4359 | 1987 |
5901
74e273e22f94
[gaim-migrate @ 6333]
Christian Hammond <chipx86@chipx86.com>
parents:
5881
diff
changeset
|
1988 if (pos != dest_page_num) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1989 gaim_conv_window_move_conversation(dest_win, pos, dest_page_num); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1990 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1991 gaim_conv_window_switch_conversation(dest_win, dest_page_num); |
4359 | 1992 } |
1993 | |
1994 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
1995 | |
1996 return TRUE; | |
1997 } | |
1998 | |
7143 | 1999 static GdkPixbuf *get_tab_icon(GaimConversation *conv) |
2000 { | |
2001 GaimAccount *account = gaim_conversation_get_account(conv); | |
2002 const char *name = gaim_conversation_get_name(conv); | |
2003 GdkPixbuf *status = NULL; | |
2004 | |
2005 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
2006 GaimBuddy *b = gaim_find_buddy(account, name); | |
2007 if (b != NULL) { | |
2008 status = gaim_gtk_blist_get_status_icon((GaimBlistNode*)b, | |
2009 GAIM_STATUS_ICON_SMALL); | |
2010 } | |
2011 } | |
2012 | |
2013 if (!status) { | |
2014 GdkPixbuf *pixbuf; | |
2015 pixbuf = create_prpl_icon(account); | |
2016 | |
2017 if (pixbuf) { | |
2018 status = gdk_pixbuf_scale_simple(pixbuf, 15, 15, | |
2019 GDK_INTERP_BILINEAR); | |
2020 g_object_unref(pixbuf); | |
2021 } | |
2022 } | |
2023 return status; | |
2024 } | |
2025 | |
7887 | 2026 /* |
2027 * Makes sure all the menu items and all the buttons are hidden/shown and | |
2028 * sensitive/insensitve. This is called after changing tabs and when an | |
2029 * account signs on or off. | |
2030 */ | |
4359 | 2031 static void |
7887 | 2032 gray_stuff_out(GaimConversation *conv) |
4359 | 2033 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2034 GaimConvWindow *win; |
7887 | 2035 GaimGtkWindow *gtkwin; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2036 GaimGtkConversation *gtkconv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2037 GaimConnection *gc; |
7887 | 2038 GaimPluginProtocolInfo *prpl_info = NULL; |
7222 | 2039 GdkPixbuf *window_icon = NULL; |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2040 |
7887 | 2041 win = gaim_conversation_get_window(conv); |
4359 | 2042 gtkwin = GAIM_GTK_WINDOW(win); |
2043 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7887 | 2044 gc = gaim_conversation_get_gc(conv); |
4359 | 2045 |
7879 | 2046 if (gc != NULL) |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
2047 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2048 |
7887 | 2049 if (gtkwin->menu.send_as != NULL) |
2050 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); | |
2051 | |
2052 /* | |
2053 * Handle hiding and showing stuff based on what type of conv this is. | |
7929 | 2054 * Stuff that Gaim IMs support in general should be shown for IM |
2055 * conversations. Stuff that Gaim chats support in gerneal should be | |
2056 * shown for chat conversations. It doesn't matter whether the PRPL | |
2057 * supports it or not--that only affects if the button or menu item | |
2058 * is sensitive or not. | |
7887 | 2059 */ |
4359 | 2060 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
7887 | 2061 /* Show stuff that applies to IMs, hide stuff that applies to chats */ |
2062 | |
2063 /* Deal with buttons */ | |
2064 gtk_widget_show(gtkconv->info); | |
2065 gtk_widget_show(gtkconv->send); | |
2066 gtk_widget_show(gtkconv->u.im->warn); | |
2067 gtk_widget_show(gtkconv->u.im->block); | |
2068 | |
2069 /* Deal with the toolbar */ | |
2070 gtk_widget_show(gtkconv->toolbar.image); | |
2071 | |
2072 /* Deal with menu items */ | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2073 gtk_widget_show(gtkwin->menu.view_log); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2074 gtk_widget_show(gtkwin->menu.add_pounce); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2075 gtk_widget_show(gtkwin->menu.get_info); |
7887 | 2076 gtk_widget_show(gtkwin->menu.warn); |
7859 | 2077 gtk_widget_hide(gtkwin->menu.invite); |
7887 | 2078 gtk_widget_show(gtkwin->menu.alias); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2079 gtk_widget_show(gtkwin->menu.block); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2080 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2081 if (gaim_find_buddy(gaim_conversation_get_account(conv), |
7143 | 2082 gaim_conversation_get_name(conv)) == NULL) { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2083 gtk_widget_show(gtkwin->menu.add); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2084 gtk_widget_hide(gtkwin->menu.remove); |
7929 | 2085 gtk_widget_show(gtkconv->add); |
2086 gtk_widget_hide(gtkconv->remove); | |
7859 | 2087 } else { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2088 gtk_widget_show(gtkwin->menu.remove); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2089 gtk_widget_hide(gtkwin->menu.add); |
7929 | 2090 gtk_widget_hide(gtkconv->add); |
2091 gtk_widget_show(gtkconv->remove); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2092 } |
7887 | 2093 |
2094 gtk_widget_show(gtkwin->menu.insert_link); | |
2095 gtk_widget_show(gtkwin->menu.insert_image); | |
2096 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
2097 /* Show stuff that applies to IMs, hide stuff that applies to chats */ | |
2098 | |
2099 /* Deal with buttons */ | |
7952 | 2100 gtk_widget_show(gtkconv->info); |
7887 | 2101 gtk_widget_show(gtkconv->send); |
2102 gtk_widget_show(gtkconv->u.chat->invite); | |
2103 | |
2104 /* Deal with the toolbar */ | |
2105 gtk_widget_hide(gtkconv->toolbar.image); | |
2106 | |
2107 /* Deal with menu items */ | |
7859 | 2108 gtk_widget_hide(gtkwin->menu.view_log); |
2109 gtk_widget_hide(gtkwin->menu.add_pounce); | |
2110 gtk_widget_hide(gtkwin->menu.get_info); | |
7887 | 2111 gtk_widget_hide(gtkwin->menu.warn); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2112 gtk_widget_show(gtkwin->menu.invite); |
7887 | 2113 gtk_widget_show(gtkwin->menu.alias); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2114 gtk_widget_hide(gtkwin->menu.block); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2115 |
7879 | 2116 if (gaim_blist_find_chat(gaim_conversation_get_account(conv), |
2117 gaim_conversation_get_name(conv)) == NULL) { | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2118 gtk_widget_show(gtkwin->menu.add); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2119 gtk_widget_hide(gtkwin->menu.remove); |
7929 | 2120 gtk_widget_show(gtkconv->add); |
2121 gtk_widget_hide(gtkconv->remove); | |
7859 | 2122 } else { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2123 gtk_widget_show(gtkwin->menu.remove); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2124 gtk_widget_hide(gtkwin->menu.add); |
7929 | 2125 gtk_widget_hide(gtkconv->add); |
2126 gtk_widget_show(gtkconv->remove); | |
7887 | 2127 } |
2128 | |
2129 gtk_widget_show(gtkwin->menu.insert_link); | |
2130 gtk_widget_hide(gtkwin->menu.insert_image); | |
2131 } | |
2132 | |
2133 /* | |
2134 * Handle graying stuff out based on whether an account is connected | |
2135 * and what features that account supports. | |
2136 */ | |
2137 if (gc != NULL) { | |
2138 /* Account is online */ | |
2139 | |
2140 /* Deal with buttons */ | |
7929 | 2141 gtk_widget_set_sensitive(gtkconv->add, TRUE); |
2142 gtk_widget_set_sensitive(gtkconv->remove, TRUE); | |
7887 | 2143 gtk_widget_set_sensitive(gtkconv->info, (prpl_info->get_info != NULL)); |
7929 | 2144 |
7887 | 2145 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
7929 | 2146 gtk_widget_set_sensitive(gtkconv->send, (prpl_info->send_im != NULL)); |
7887 | 2147 gtk_widget_set_sensitive(gtkconv->u.im->warn, |
2148 (prpl_info->warn != NULL)); | |
2149 gtk_widget_set_sensitive(gtkconv->u.im->block, | |
2150 (prpl_info->add_deny != NULL)); | |
2151 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
2152 gtk_widget_set_sensitive(gtkconv->send, (prpl_info->chat_send != NULL)); | |
2153 gtk_widget_set_sensitive(gtkconv->u.chat->invite, | |
2154 (prpl_info->chat_invite != NULL)); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2155 } |
7887 | 2156 |
2157 /* Deal with the toolbar */ | |
7929 | 2158 gtk_widget_set_sensitive(gtkconv->toolbar.link, TRUE); |
7887 | 2159 gtk_widget_set_sensitive(gtkconv->toolbar.image, |
2160 (prpl_info->options & OPT_PROTO_IM_IMAGE)); | |
7888 | 2161 gtk_widget_set_sensitive(gtkconv->toolbar.bgcolor, |
2162 !(gc->flags & GAIM_CONNECTION_NO_BGCOLOR)); | |
7887 | 2163 |
2164 /* Deal with menu items */ | |
2165 gtk_widget_set_sensitive(gtkwin->menu.view_log, TRUE); | |
2166 gtk_widget_set_sensitive(gtkwin->menu.add_pounce, TRUE); | |
2167 gtk_widget_set_sensitive(gtkwin->menu.get_info, (prpl_info->get_info != NULL)); | |
2168 gtk_widget_set_sensitive(gtkwin->menu.warn, (prpl_info->warn != NULL)); | |
2169 gtk_widget_set_sensitive(gtkwin->menu.invite, | |
2170 (prpl_info->chat_invite != NULL)); | |
2171 | |
2172 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
2173 if (gaim_find_buddy(gaim_conversation_get_account(conv), | |
2174 gaim_conversation_get_name(conv)) == NULL) | |
2175 gtk_widget_set_sensitive(gtkwin->menu.alias, FALSE); | |
2176 else | |
2177 gtk_widget_set_sensitive(gtkwin->menu.alias, TRUE); | |
2178 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
2179 if (gaim_blist_find_chat(gaim_conversation_get_account(conv), | |
2180 gaim_conversation_get_name(conv)) == NULL) | |
2181 gtk_widget_set_sensitive(gtkwin->menu.alias, FALSE); | |
2182 else | |
2183 gtk_widget_set_sensitive(gtkwin->menu.alias, TRUE); | |
2184 } | |
2185 | |
7931 | 2186 gtk_widget_set_sensitive(gtkwin->menu.block, (prpl_info->add_deny != NULL)); |
7887 | 2187 gtk_widget_set_sensitive(gtkwin->menu.add, TRUE); |
7859 | 2188 gtk_widget_set_sensitive(gtkwin->menu.remove, TRUE); |
7887 | 2189 gtk_widget_set_sensitive(gtkwin->menu.insert_link, TRUE); |
2190 gtk_widget_set_sensitive(gtkwin->menu.insert_image, | |
2191 (prpl_info->options & OPT_PROTO_IM_IMAGE)); | |
2192 } else { | |
2193 /* Account is offline */ | |
2194 | |
2195 /* Deal with buttons */ | |
7929 | 2196 gtk_widget_set_sensitive(gtkconv->add, FALSE); |
2197 gtk_widget_set_sensitive(gtkconv->remove, FALSE); | |
7887 | 2198 gtk_widget_set_sensitive(gtkconv->info, FALSE); |
2199 gtk_widget_set_sensitive(gtkconv->send, FALSE); | |
2200 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
2201 gtk_widget_set_sensitive(gtkconv->u.im->warn, FALSE); | |
2202 gtk_widget_set_sensitive(gtkconv->u.im->block, FALSE); | |
2203 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
2204 gtk_widget_set_sensitive(gtkconv->u.chat->invite, FALSE); | |
2205 } | |
2206 | |
2207 /* Deal with the toolbar */ | |
7929 | 2208 gtk_widget_set_sensitive(gtkconv->toolbar.link, TRUE); |
7887 | 2209 gtk_widget_set_sensitive(gtkconv->toolbar.image, FALSE); |
2210 | |
2211 /* Then deal with menu items */ | |
2212 gtk_widget_set_sensitive(gtkwin->menu.view_log, TRUE); | |
2213 gtk_widget_set_sensitive(gtkwin->menu.add_pounce, TRUE); | |
2214 gtk_widget_set_sensitive(gtkwin->menu.get_info, FALSE); | |
2215 gtk_widget_set_sensitive(gtkwin->menu.warn, FALSE); | |
2216 gtk_widget_set_sensitive(gtkwin->menu.invite, FALSE); | |
2217 gtk_widget_set_sensitive(gtkwin->menu.alias, FALSE); | |
2218 gtk_widget_set_sensitive(gtkwin->menu.block, FALSE); | |
2219 gtk_widget_set_sensitive(gtkwin->menu.add, FALSE); | |
2220 gtk_widget_set_sensitive(gtkwin->menu.remove, FALSE); | |
7929 | 2221 gtk_widget_set_sensitive(gtkwin->menu.insert_link, TRUE); |
7887 | 2222 gtk_widget_set_sensitive(gtkwin->menu.insert_image, FALSE); |
2223 } | |
2224 | |
2225 /* | |
2226 * Update the window's icon | |
2227 */ | |
2228 if ((gaim_conversation_get_type(conv) == GAIM_CONV_IM) && (gtkconv->u.im->anim)) { | |
2229 window_icon = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); | |
2230 g_object_ref(window_icon); | |
2231 } else { | |
7219 | 2232 window_icon = get_tab_icon(conv); |
4359 | 2233 } |
7887 | 2234 gtk_window_set_icon(GTK_WINDOW(gtkwin->window), window_icon); |
2235 g_object_unref(G_OBJECT(window_icon)); | |
2236 } | |
2237 | |
2238 static void | |
2239 switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, | |
2240 gpointer user_data) | |
2241 { | |
2242 GaimConvWindow *win; | |
2243 GaimConversation *conv; | |
2244 GaimGtkConversation *gtkconv; | |
2245 GaimGtkWindow *gtkwin; | |
2246 | |
2247 win = (GaimConvWindow *)user_data; | |
2248 conv = gaim_conv_window_get_conversation_at(win, page_num); | |
2249 | |
2250 g_return_if_fail(conv != NULL); | |
2251 | |
2252 gtkwin = GAIM_GTK_WINDOW(win); | |
2253 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2254 | |
2255 gaim_conversation_set_unseen(conv, GAIM_UNSEEN_NONE); | |
2256 | |
2257 /* Update the menubar */ | |
2258 gray_stuff_out(conv); | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2259 |
4736 | 2260 update_typing_icon(conv); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2261 |
4359 | 2262 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.logging), |
7143 | 2263 gaim_conversation_is_logging(conv)); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2264 |
4359 | 2265 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.sounds), |
7143 | 2266 gtkconv->make_sound); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2267 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2268 gtk_check_menu_item_set_active( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2269 GTK_CHECK_MENU_ITEM(gtkwin->menu.show_formatting_toolbar), |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2270 gtkconv->show_formatting_toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2271 |
4359 | 2272 gtk_widget_grab_focus(gtkconv->entry); |
4681 | 2273 |
4965 | 2274 gtk_window_set_title(GTK_WINDOW(gtkwin->window), |
7143 | 2275 gtk_label_get_text(GTK_LABEL(gtkconv->tab_label))); |
4359 | 2276 } |
2277 | |
2278 /************************************************************************** | |
2279 * Utility functions | |
2280 **************************************************************************/ | |
2281 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2282 do_bold(GtkWidget *bold, GaimGtkConversation *gtkconv) |
4359 | 2283 { |
7695 | 2284 gtk_imhtml_toggle_bold(GTK_IMHTML(gtkconv->entry)); |
4359 | 2285 gtk_widget_grab_focus(gtkconv->entry); |
2286 } | |
2287 | |
2288 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2289 do_italic(GtkWidget *italic, GaimGtkConversation *gtkconv) |
4359 | 2290 { |
7695 | 2291 gtk_imhtml_toggle_italic(GTK_IMHTML(gtkconv->entry)); |
4359 | 2292 gtk_widget_grab_focus(gtkconv->entry); |
2293 } | |
2294 | |
2295 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2296 do_underline(GtkWidget *underline, GaimGtkConversation *gtkconv) |
4359 | 2297 { |
7695 | 2298 gtk_imhtml_toggle_underline(GTK_IMHTML(gtkconv->entry)); |
4359 | 2299 gtk_widget_grab_focus(gtkconv->entry); |
2300 } | |
2301 | |
2302 static void | |
7242
59ffe137176d
[gaim-migrate @ 7817]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7222
diff
changeset
|
2303 do_small(GtkWidget *smalltb, GaimGtkConversation *gtkconv) |
4359 | 2304 { |
7740 | 2305 gtk_imhtml_font_shrink(GTK_IMHTML(gtkconv->entry)); |
4359 | 2306 gtk_widget_grab_focus(gtkconv->entry); |
2307 } | |
2308 | |
2309 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2310 do_big(GtkWidget *large, GaimGtkConversation *gtkconv) |
4359 | 2311 { |
7740 | 2312 gtk_imhtml_font_grow(GTK_IMHTML(gtkconv->entry)); |
4359 | 2313 gtk_widget_grab_focus(gtkconv->entry); |
2314 } | |
2315 | |
2316 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2317 toggle_font(GtkWidget *font, GaimConversation *conv) |
4359 | 2318 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2319 GaimGtkConversation *gtkconv; |
4359 | 2320 |
2321 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2322 | |
7717 | 2323 show_font_dialog(conv, font); |
4359 | 2324 } |
2325 | |
2326 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2327 toggle_fg_color(GtkWidget *color, GaimConversation *conv) |
4359 | 2328 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2329 GaimGtkConversation *gtkconv; |
4359 | 2330 |
2331 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2332 | |
2333 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(color))) | |
2334 show_fgcolor_dialog(conv, color); | |
2335 else if (gtkconv->dialogs.fg_color != NULL) | |
2336 cancel_fgcolor(color, conv); | |
2337 else | |
2338 gaim_gtk_advance_past(gtkconv, "<FONT COLOR>", "</FONT>"); | |
2339 } | |
2340 | |
2341 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2342 toggle_bg_color(GtkWidget *color, GaimConversation *conv) |
4359 | 2343 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2344 GaimGtkConversation *gtkconv; |
4359 | 2345 |
2346 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2347 | |
2348 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(color))) | |
2349 show_bgcolor_dialog(conv, color); | |
2350 else if (gtkconv->dialogs.bg_color != NULL) | |
2351 cancel_bgcolor(color, conv); | |
2352 else | |
2353 gaim_gtk_advance_past(gtkconv, "<BODY BGCOLOR>", "</BODY>"); | |
2354 } | |
2355 | |
2356 static void | |
2357 check_everything(GtkTextBuffer *buffer) | |
2358 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2359 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2360 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2361 |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2362 conv = (GaimConversation *)g_object_get_data(G_OBJECT(buffer), |
4359 | 2363 "user_data"); |
2364 | |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2365 g_return_if_fail(conv != NULL); |
4359 | 2366 |
2367 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2368 | |
2369 /* CONV TODO */ | |
2370 } | |
2371 | |
2372 static void | |
4685 | 2373 set_toggle(GtkWidget *tb, gboolean active) |
4359 | 2374 { |
2375 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(tb), active); | |
2376 } | |
2377 | |
2378 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2379 got_typing_keypress(GaimConversation *conv, gboolean first) |
4359 | 2380 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2381 GaimConvIm *im; |
4685 | 2382 |
4359 | 2383 /* |
2384 * 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
|
2385 * send GAIM_TYPED any time soon. |
4359 | 2386 */ |
2387 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2388 im = GAIM_CONV_IM(conv); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2389 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2390 if (gaim_conv_im_get_type_again_timeout(im)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2391 gaim_conv_im_stop_type_again_timeout(im); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2392 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2393 gaim_conv_im_start_type_again_timeout(im); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2394 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2395 if (first || (gaim_conv_im_get_type_again(im) != 0 && |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2396 time(NULL) > gaim_conv_im_get_type_again(im))) { |
4359 | 2397 |
2398 int timeout = serv_send_typing(gaim_conversation_get_gc(conv), | |
2399 (char *)gaim_conversation_get_name(conv), | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
2400 GAIM_TYPING); |
4359 | 2401 |
2402 if (timeout) | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2403 gaim_conv_im_set_type_again(im, time(NULL) + timeout); |
4359 | 2404 else |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2405 gaim_conv_im_set_type_again(im, 0); |
4359 | 2406 } |
2407 } | |
2408 | |
4736 | 2409 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2410 update_typing_icon(GaimConversation *conv) |
4736 | 2411 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2412 GaimGtkWindow *gtkwin; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2413 GaimConvIm *im = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2414 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); |
4736 | 2415 |
2416 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); | |
2417 | |
2418 if(gaim_conversation_get_type(conv) == GAIM_CONV_IM) | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2419 im = GAIM_CONV_IM(conv); |
4736 | 2420 |
2421 if(gtkwin->menu.typing_icon) { | |
2422 gtk_widget_destroy(gtkwin->menu.typing_icon); | |
2423 gtkwin->menu.typing_icon = NULL; | |
2424 } | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2425 if(im && gaim_conv_im_get_typing_state(im) == GAIM_TYPING) { |
4736 | 2426 gtkwin->menu.typing_icon = gtk_image_menu_item_new(); |
2427 gtk_image_menu_item_set_image( | |
2428 GTK_IMAGE_MENU_ITEM(gtkwin->menu.typing_icon), | |
2429 gtk_image_new_from_stock(GAIM_STOCK_TYPING, | |
2430 GTK_ICON_SIZE_MENU)); | |
4757 | 2431 gtk_tooltips_set_tip(gtkconv->tooltips, gtkwin->menu.typing_icon, |
4736 | 2432 _("User is typing..."), NULL); |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2433 } else if(im && gaim_conv_im_get_typing_state(im) == GAIM_TYPED) { |
4736 | 2434 gtkwin->menu.typing_icon = gtk_image_menu_item_new(); |
2435 gtk_image_menu_item_set_image( | |
2436 GTK_IMAGE_MENU_ITEM(gtkwin->menu.typing_icon), | |
2437 gtk_image_new_from_stock(GAIM_STOCK_TYPED, | |
2438 GTK_ICON_SIZE_MENU)); | |
4757 | 2439 gtk_tooltips_set_tip(gtkconv->tooltips, gtkwin->menu.typing_icon, |
4736 | 2440 _("User has typed something and paused"), NULL); |
2441 } | |
2442 | |
2443 if(gtkwin->menu.typing_icon) { | |
2444 gtk_menu_item_set_right_justified( | |
2445 GTK_MENU_ITEM(gtkwin->menu.typing_icon), TRUE); | |
2446 gtk_widget_show_all(gtkwin->menu.typing_icon); | |
2447 gtk_menu_shell_append(GTK_MENU_SHELL(gtkwin->menu.menubar), | |
2448 gtkwin->menu.typing_icon); | |
2449 } | |
2450 } | |
2451 | |
4685 | 2452 static gboolean |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2453 update_send_as_selection(GaimConvWindow *win) |
4359 | 2454 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2455 GaimAccount *account; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2456 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2457 GaimGtkWindow *gtkwin; |
4359 | 2458 GtkWidget *menu; |
2459 GList *child; | |
2460 | |
7090
04f9f7440bc3
[gaim-migrate @ 7655]
Christian Hammond <chipx86@chipx86.com>
parents:
7089
diff
changeset
|
2461 if (g_list_find(gaim_get_windows(), win) == NULL) |
04f9f7440bc3
[gaim-migrate @ 7655]
Christian Hammond <chipx86@chipx86.com>
parents:
7089
diff
changeset
|
2462 return FALSE; |
4849 | 2463 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2464 conv = gaim_conv_window_get_active_conversation(win); |
4359 | 2465 |
5860
52d5fad43950
[gaim-migrate @ 6291]
Christian Hammond <chipx86@chipx86.com>
parents:
5858
diff
changeset
|
2466 if (conv == NULL) |
52d5fad43950
[gaim-migrate @ 6291]
Christian Hammond <chipx86@chipx86.com>
parents:
5858
diff
changeset
|
2467 return FALSE; |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2468 |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2469 account = gaim_conversation_get_account(conv); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2470 gtkwin = GAIM_GTK_WINDOW(win); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2471 |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2472 if (gtkwin->menu.send_as == NULL) |
4685 | 2473 return FALSE; |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2474 |
4359 | 2475 gtk_widget_show(gtkwin->menu.send_as); |
2476 | |
2477 menu = gtk_menu_item_get_submenu( | |
2478 GTK_MENU_ITEM(gtkwin->menu.send_as)); | |
2479 | |
2480 for (child = gtk_container_get_children(GTK_CONTAINER(menu)); | |
2481 child != NULL; | |
2482 child = child->next) { | |
2483 | |
2484 GtkWidget *item = child->data; | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2485 GaimAccount *item_account = g_object_get_data(G_OBJECT(item), |
4673 | 2486 "gaim_account"); |
2487 | |
2488 if (account == item_account) { | |
4359 | 2489 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE); |
2490 break; | |
2491 } | |
2492 } | |
6030
54c37db13279
[gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents:
6016
diff
changeset
|
2493 |
4685 | 2494 return FALSE; |
4359 | 2495 } |
2496 | |
2497 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2498 generate_send_as_items(GaimConvWindow *win, GaimConversation *deleted_conv) |
4359 | 2499 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2500 GaimGtkWindow *gtkwin; |
4359 | 2501 GtkWidget *menu; |
2502 GtkWidget *menuitem; | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2503 GList *gcs; |
4359 | 2504 GList *convs; |
2505 GSList *group = NULL; | |
2506 gboolean first_offline = TRUE; | |
2507 gboolean found_online = FALSE; | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2508 GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
4359 | 2509 |
2510 gtkwin = GAIM_GTK_WINDOW(win); | |
2511 | |
2512 if (gtkwin->menu.send_as != NULL) | |
2513 gtk_widget_destroy(gtkwin->menu.send_as); | |
2514 | |
2515 /* See if we have > 1 connection active. */ | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2516 if (g_list_length(gaim_connections_get_all()) < 2) { |
4359 | 2517 /* Now make sure we don't have any Offline entries. */ |
2518 gboolean found_offline = FALSE; | |
2519 | |
2520 for (convs = gaim_get_conversations(); | |
2521 convs != NULL; | |
2522 convs = convs->next) { | |
2523 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2524 GaimConversation *conv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2525 GaimAccount *account; |
4491 | 2526 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2527 conv = (GaimConversation *)convs->data; |
4491 | 2528 account = gaim_conversation_get_account(conv); |
2529 | |
6495
8ce66049ce68
[gaim-migrate @ 7010]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
2530 if (account != NULL && account->gc == NULL) { |
4359 | 2531 found_offline = TRUE; |
2532 break; | |
2533 } | |
2534 } | |
2535 | |
2536 if (!found_offline) { | |
2537 gtkwin->menu.send_as = NULL; | |
2538 return; | |
2539 } | |
2540 } | |
2541 | |
2542 /* Build the Send As menu */ | |
2543 gtkwin->menu.send_as = gtk_menu_item_new_with_mnemonic(_("_Send As")); | |
2544 gtk_widget_show(gtkwin->menu.send_as); | |
2545 | |
2546 menu = gtk_menu_new(); | |
7857
43f63ff8a6d8
[gaim-migrate @ 8511]
Christian Hammond <chipx86@chipx86.com>
parents:
7855
diff
changeset
|
2547 gtk_menu_shell_insert(GTK_MENU_SHELL(gtkwin->menu.menubar), |
43f63ff8a6d8
[gaim-migrate @ 8511]
Christian Hammond <chipx86@chipx86.com>
parents:
7855
diff
changeset
|
2548 gtkwin->menu.send_as, 2); |
4359 | 2549 gtk_menu_item_set_submenu(GTK_MENU_ITEM(gtkwin->menu.send_as), menu); |
2550 | |
2551 gtk_widget_show(menu); | |
2552 | |
2553 /* Fill it with entries. */ | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2554 for (gcs = gaim_connections_get_all(); gcs != NULL; gcs = gcs->next) { |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2555 |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2556 GaimConnection *gc; |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2557 GaimAccount *account; |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2558 GtkWidget *box; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2559 GtkWidget *label; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2560 GtkWidget *image; |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2561 GdkPixbuf *pixbuf, *scale; |
4359 | 2562 |
2563 found_online = TRUE; | |
2564 | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2565 gc = (GaimConnection *)gcs->data; |
4359 | 2566 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2567 /* Create a pixmap for the protocol icon. */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2568 pixbuf = create_prpl_icon(gc->account); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2569 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
|
2570 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2571 /* Now convert it to GtkImage */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2572 if (pixbuf == NULL) |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2573 image = gtk_image_new(); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2574 else |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2575 image = gtk_image_new_from_pixbuf(scale); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2576 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2577 gtk_size_group_add_widget(sg, image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2578 |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2579 g_object_unref(G_OBJECT(scale)); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2580 g_object_unref(G_OBJECT(pixbuf)); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2581 |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2582 account = gaim_connection_get_account(gc); |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2583 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2584 /* Make our menu item */ |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2585 menuitem = gtk_radio_menu_item_new_with_label(group, |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2586 gaim_account_get_username(account)); |
4793 | 2587 group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem)); |
4359 | 2588 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2589 /* Do some evil, see some evil, speak some evil. */ |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2590 box = gtk_hbox_new(FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2591 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2592 label = gtk_bin_get_child(GTK_BIN(menuitem)); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2593 g_object_ref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2594 gtk_container_remove(GTK_CONTAINER(menuitem), label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2595 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2596 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2597 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 4); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2598 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2599 g_object_unref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2600 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2601 gtk_container_add(GTK_CONTAINER(menuitem), box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2602 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2603 gtk_widget_show(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2604 gtk_widget_show(image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2605 gtk_widget_show(box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2606 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2607 /* Set our data and callbacks. */ |
4359 | 2608 g_object_set_data(G_OBJECT(menuitem), "user_data", win); |
4673 | 2609 g_object_set_data(G_OBJECT(menuitem), "gaim_account", gc->account); |
4359 | 2610 |
4786 | 2611 g_signal_connect(G_OBJECT(menuitem), "activate", |
4673 | 2612 G_CALLBACK(menu_conv_sel_send_cb), NULL); |
4359 | 2613 |
2614 gtk_widget_show(menuitem); | |
2615 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
2616 } | |
2617 | |
2618 /* | |
2619 * Fill it with any accounts that still has an open (yet disabled) window | |
2620 * (signed off accounts with a window open). | |
2621 */ | |
2622 for (convs = gaim_get_conversations(); | |
2623 convs != NULL; | |
2624 convs = convs->next) { | |
2625 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2626 GaimConversation *conv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2627 GaimAccount *account; |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2628 GtkWidget *box; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2629 GtkWidget *label; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2630 GtkWidget *image; |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2631 GdkPixbuf *pixbuf, *scale; |
4359 | 2632 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2633 conv = (GaimConversation *)convs->data; |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
2634 |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
2635 if (conv == deleted_conv) |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
2636 continue; |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
2637 |
4491 | 2638 account = gaim_conversation_get_account(conv); |
2639 | |
6495
8ce66049ce68
[gaim-migrate @ 7010]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
2640 if (account != NULL && account->gc == NULL) { |
4359 | 2641 if (first_offline && found_online) { |
2642 menuitem = gtk_separator_menu_item_new(); | |
2643 gtk_widget_show(menuitem); | |
2644 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
2645 | |
2646 first_offline = FALSE; | |
2647 } | |
2648 | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2649 /* Create a pixmap for the protocol icon. */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2650 pixbuf = create_prpl_icon(account); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2651 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2652 GDK_INTERP_BILINEAR); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2653 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2654 /* Now convert it to GtkImage */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2655 if (pixbuf == NULL) |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2656 image = gtk_image_new(); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2657 else |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2658 image = gtk_image_new_from_pixbuf(scale); |
4669
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_size_group_add_widget(sg, image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2661 |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2662 if (scale != NULL) g_object_unref(scale); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2663 if (pixbuf != NULL) g_object_unref(pixbuf); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2664 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2665 /* Make our menu item */ |
4359 | 2666 menuitem = gtk_radio_menu_item_new_with_label(group, |
4491 | 2667 account->username); |
4793 | 2668 group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem)); |
4359 | 2669 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2670 /* Do some evil, see some evil, speak some evil. */ |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2671 box = gtk_hbox_new(FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2672 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2673 label = gtk_bin_get_child(GTK_BIN(menuitem)); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2674 g_object_ref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2675 gtk_container_remove(GTK_CONTAINER(menuitem), label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2676 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2677 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2678 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 4); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2679 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2680 g_object_unref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2681 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2682 gtk_container_add(GTK_CONTAINER(menuitem), box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2683 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2684 gtk_widget_show(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2685 gtk_widget_show(image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2686 gtk_widget_show(box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2687 |
4359 | 2688 gtk_widget_set_sensitive(menuitem, FALSE); |
4786 | 2689 g_object_set_data(G_OBJECT(menuitem), "user_data", win); |
4674 | 2690 g_object_set_data(G_OBJECT(menuitem), "gaim_account", account); |
4359 | 2691 |
4786 | 2692 g_signal_connect(G_OBJECT(menuitem), "activate", |
5902
6889b89cab90
[gaim-migrate @ 6334]
Christian Hammond <chipx86@chipx86.com>
parents:
5901
diff
changeset
|
2693 G_CALLBACK(menu_conv_sel_send_cb), NULL); |
4786 | 2694 |
4359 | 2695 gtk_widget_show(menuitem); |
2696 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
2697 } | |
2698 } | |
2699 | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2700 g_object_unref(sg); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2701 |
4359 | 2702 gtk_widget_show(gtkwin->menu.send_as); |
2703 update_send_as_selection(win); | |
2704 } | |
2705 | |
2706 static GList * | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2707 generate_invite_user_names(GaimConnection *gc) |
4359 | 2708 { |
6695 | 2709 GaimBlistNode *gnode,*cnode,*bnode; |
4359 | 2710 static GList *tmp = NULL; |
2711 | |
2712 if (tmp) | |
2713 g_list_free(tmp); | |
2714 | |
2715 tmp = g_list_append(NULL, ""); | |
2716 | |
2717 if (gc != NULL) { | |
4785 | 2718 for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { |
2719 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) | |
2720 continue; | |
6695 | 2721 for(cnode = gnode->child; cnode; cnode = cnode->next) { |
2722 if(!GAIM_BLIST_NODE_IS_CONTACT(cnode)) | |
4785 | 2723 continue; |
6695 | 2724 for(bnode = cnode->child; bnode; bnode = bnode->next) { |
2725 GaimBuddy *buddy; | |
2726 | |
2727 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) | |
2728 continue; | |
2729 | |
2730 buddy = (GaimBuddy *)bnode; | |
2731 | |
2732 if (buddy->account == gc->account && | |
2733 GAIM_BUDDY_IS_ONLINE(buddy)) | |
2734 tmp = g_list_append(tmp, buddy->name); | |
2735 } | |
4359 | 2736 } |
2737 } | |
2738 } | |
2739 | |
2740 return tmp; | |
2741 } | |
2742 | |
2743 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2744 add_chat_buddy_common(GaimConversation *conv, const char *name, int pos) |
4359 | 2745 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2746 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2747 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2748 GaimConvChat *chat; |
4359 | 2749 GtkTreeIter iter; |
2750 GtkListStore *ls; | |
2751 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2752 chat = GAIM_CONV_CHAT(conv); |
4359 | 2753 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2754 gtkchat = gtkconv->u.chat; | |
2755 | |
2756 ls = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list))); | |
2757 | |
2758 gtk_list_store_append(ls, &iter); | |
2759 gtk_list_store_set(ls, &iter, 0, | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2760 (gaim_conv_chat_is_user_ignored(chat, name) ? "X" : " "), |
4359 | 2761 1, name, -1); |
2762 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), 1, | |
2763 GTK_SORT_ASCENDING); | |
2764 } | |
2765 | |
2766 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2767 tab_complete(GaimConversation *conv) |
4359 | 2768 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2769 GaimGtkConversation *gtkconv; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2770 GaimConvChat *chat; |
4359 | 2771 GtkTextIter cursor, word_start, start_buffer; |
2772 int start; | |
2773 int most_matched = -1; | |
2774 char *entered, *partial = NULL; | |
2775 char *text; | |
2776 GList *matches = NULL; | |
2777 GList *nicks = NULL; | |
2778 | |
2779 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2780 chat = GAIM_CONV_CHAT(conv); |
4359 | 2781 |
2782 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_buffer); | |
2783 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, | |
2784 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
2785 | |
2786 word_start = cursor; | |
2787 | |
2788 /* if there's nothing there just return */ | |
2789 if (!gtk_text_iter_compare(&cursor, &start_buffer)) | |
2790 return; | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2791 |
4359 | 2792 text = gtk_text_buffer_get_text(gtkconv->entry_buffer, &start_buffer, |
2793 &cursor, FALSE); | |
2794 | |
2795 /* if we're at the end of ": " we need to move back 2 spaces */ | |
2796 start = strlen(text) - 1; | |
2797 | |
2798 if (strlen(text) >= 2 && !strncmp(&text[start-1], ": ", 2)) | |
2799 gtk_text_iter_backward_chars(&word_start, 2); | |
2800 | |
2801 /* find the start of the word that we're tabbing */ | |
2802 while (start >= 0 && text[start] != ' ') { | |
2803 gtk_text_iter_backward_char(&word_start); | |
2804 start--; | |
2805 } | |
2806 | |
2807 g_free(text); | |
2808 | |
2809 entered = gtk_text_buffer_get_text(gtkconv->entry_buffer, &word_start, | |
2810 &cursor, FALSE); | |
2811 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
2812 if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/old_tab_complete")) { |
4359 | 2813 if (strlen(entered) >= 2 && |
2814 !strncmp(": ", entered + strlen(entered) - 2, 2)) { | |
2815 | |
2816 entered[strlen(entered) - 2] = 0; | |
2817 } | |
2818 } | |
2819 | |
2820 if (!strlen(entered)) { | |
2821 g_free(entered); | |
2822 return; | |
2823 } | |
2824 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2825 for (nicks = gaim_conv_chat_get_users(chat); |
4359 | 2826 nicks != NULL; |
2827 nicks = nicks->next) { | |
2828 | |
2829 char *nick = nicks->data; | |
2830 /* this checks to see if the current nick could be a completion */ | |
4793 | 2831 if (g_ascii_strncasecmp(nick, entered, strlen(entered))) { |
2832 if (g_ascii_strncasecmp(nick + 1, entered, strlen(entered))) { | |
2833 if (g_ascii_strncasecmp(nick + 2, entered, strlen(entered))) | |
4359 | 2834 continue; |
2835 else | |
2836 nick += 2; | |
2837 } | |
2838 else | |
2839 nick++; | |
2840 } | |
2841 | |
2842 /* if we're here, it's a possible completion */ | |
2843 | |
2844 /* 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
|
2845 if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/old_tab_complete")) { |
4359 | 2846 gtk_text_buffer_delete(gtkconv->entry_buffer, |
2847 &word_start, &cursor); | |
2848 | |
2849 if (strlen(nick) == strlen(entered)) { | |
2850 nicks = (nicks->next | |
2851 ? nicks->next | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2852 : gaim_conv_chat_get_users(chat)); |
4359 | 2853 |
2854 nick = nicks->data; | |
2855 } | |
2856 | |
2857 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, | |
2858 &start_buffer); | |
2859 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, | |
2860 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
2861 | |
2862 if (!gtk_text_iter_compare(&cursor, &start_buffer)) { | |
2863 char *tmp = g_strdup_printf("%s: ", nick); | |
2864 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, | |
2865 tmp, -1); | |
2866 g_free(tmp); | |
2867 } | |
2868 else | |
2869 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, | |
2870 nick, -1); | |
2871 | |
2872 g_free(entered); | |
2873 | |
2874 return; | |
2875 } | |
2876 | |
2877 /* we're only here if we're doing new style */ | |
2878 if (most_matched == -1) { | |
2879 /* | |
2880 * this will only get called once, since from now | |
2881 * on most_matched is >= 0 | |
2882 */ | |
2883 most_matched = strlen(nick); | |
2884 partial = g_strdup(nick); | |
2885 } | |
2886 else if (most_matched) { | |
4793 | 2887 while (g_ascii_strncasecmp(nick, partial, most_matched)) |
4359 | 2888 most_matched--; |
2889 | |
2890 partial[most_matched] = 0; | |
2891 } | |
2892 | |
2893 matches = g_list_append(matches, nick); | |
2894 } | |
2895 | |
2896 /* we're only here if we're doing new style */ | |
2897 | |
2898 /* if there weren't any matches, return */ | |
2899 if (!matches) { | |
2900 /* if matches isn't set partials won't be either */ | |
2901 g_free(entered); | |
2902 return; | |
2903 } | |
2904 | |
2905 gtk_text_buffer_delete(gtkconv->entry_buffer, &word_start, &cursor); | |
2906 | |
2907 if (!matches->next) { | |
2908 /* there was only one match. fill it in. */ | |
2909 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_buffer); | |
2910 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, | |
2911 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
2912 | |
2913 if (!gtk_text_iter_compare(&cursor, &start_buffer)) { | |
2914 char *tmp = g_strdup_printf("%s: ", (char *)matches->data); | |
2915 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, tmp, -1); | |
2916 g_free(tmp); | |
2917 } | |
2918 else | |
2919 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, | |
2920 matches->data, -1); | |
2921 | |
2922 matches = g_list_remove(matches, matches->data); | |
2923 } | |
2924 else { | |
2925 /* | |
2926 * there were lots of matches, fill in as much as possible | |
2927 * and display all of them | |
2928 */ | |
2929 char *addthis = g_malloc0(1); | |
2930 | |
2931 while (matches) { | |
2932 char *tmp = addthis; | |
2933 addthis = g_strconcat(tmp, matches->data, " ", NULL); | |
2934 g_free(tmp); | |
2935 matches = g_list_remove(matches, matches->data); | |
2936 } | |
2937 | |
6982 | 2938 gaim_conversation_write(conv, NULL, addthis, GAIM_MESSAGE_NO_LOG, |
4359 | 2939 time(NULL)); |
2940 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, partial, -1); | |
2941 g_free(addthis); | |
2942 } | |
2943 | |
2944 g_free(entered); | |
2945 g_free(partial); | |
2946 } | |
2947 | |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2948 static void |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2949 save_convo(GtkWidget *save, GaimConversation *c) |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2950 { |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2951 char buf[BUF_LONG]; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2952 GtkWidget *window; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2953 |
7859 | 2954 window = gtk_file_selection_new(_("Save Conversation")); |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2955 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2956 g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S "%s.log", |
7261 | 2957 gaim_home_dir(), gaim_normalize(c->account, c->name)); |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2958 gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2959 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
|
2960 "gaim_conversation", c); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2961 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(window)->ok_button), |
6038 | 2962 "clicked", G_CALLBACK(do_check_save_convo), window); |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2963 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
|
2964 "clicked", G_CALLBACK(gtk_widget_destroy), (gpointer)window); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2965 gtk_widget_show(window); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2966 } |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
2967 |
4359 | 2968 static GtkItemFactoryEntry menu_items[] = |
2969 { | |
2970 /* Conversation menu */ | |
4596 | 2971 { N_("/_Conversation"), NULL, NULL, 0, "<Branch>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2972 |
7887 | 2973 { N_("/Conversation/New Instant _Message..."), "<CTL>M", menu_new_conv_cb, |
7859 | 2974 0, "<StockItem>", GAIM_STOCK_IM }, |
2975 | |
2976 { "/Conversation/sep0", NULL, NULL, 0, "<Separator>" }, | |
2977 | |
7880 | 2978 { N_("/Conversation/_Find..."), NULL, menu_find_cb, 0, "<StockItem>", GTK_STOCK_FIND }, |
7859 | 2979 { N_("/Conversation/View _Log"), NULL, menu_view_log_cb, 0, NULL }, |
4596 | 2980 { N_("/Conversation/_Save As..."), NULL, menu_save_as_cb, 0, |
4359 | 2981 "<StockItem>", GTK_STOCK_SAVE_AS }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2982 |
4359 | 2983 { "/Conversation/sep1", NULL, NULL, 0, "<Separator>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2984 |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
2985 { N_("/Conversation/Add Buddy _Pounce..."), NULL, menu_add_pounce_cb, |
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
2986 0, NULL }, |
7859 | 2987 { N_("/Conversation/_Get Info"), NULL, menu_get_info_cb, 0, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2988 "<StockItem>", GAIM_STOCK_INFO }, |
7859 | 2989 { N_("/Conversation/_Warn..."), NULL, menu_warn_cb, 0, |
2990 "<StockItem>", GAIM_STOCK_WARN }, | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2991 { N_("/Conversation/In_vite..."), NULL, menu_invite_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2992 "<StockItem>", GAIM_STOCK_INVITE }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2993 |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
2994 { "/Conversation/sep2", NULL, NULL, 0, "<Separator>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2995 |
7859 | 2996 { N_("/Conversation/A_lias..."), NULL, menu_alias_cb, 0, |
2997 "<StockItem>", GAIM_STOCK_EDIT }, | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2998 { N_("/Conversation/_Block..."), NULL, menu_block_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2999 "<StockItem>", GAIM_STOCK_BLOCK }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3000 { N_("/Conversation/_Add..."), NULL, menu_add_remove_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3001 "<StockItem>", GTK_STOCK_ADD }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3002 { N_("/Conversation/_Remove..."), NULL, menu_add_remove_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3003 "<StockItem>", GTK_STOCK_REMOVE }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3004 |
7859 | 3005 { "/Conversation/sep3", NULL, NULL, 0, "<Separator>" }, |
3006 | |
3007 { N_("/Conversation/Insert Lin_k..."), NULL, menu_insert_link_cb, 0, | |
3008 "<StockItem>", GAIM_STOCK_LINK }, | |
3009 { N_("/Conversation/Insert Imag_e..."), NULL, menu_insert_image_cb, 0, | |
3010 "<StockItem>", GAIM_STOCK_IMAGE }, | |
3011 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3012 { "/Conversation/sep4", NULL, NULL, 0, "<Separator>" }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3013 |
4596 | 3014 { N_("/Conversation/_Close"), NULL, menu_close_conv_cb, 0, |
4359 | 3015 "<StockItem>", GTK_STOCK_CLOSE }, |
3016 | |
3017 /* Options */ | |
4596 | 3018 { N_("/_Options"), NULL, NULL, 0, "<Branch>" }, |
3019 { N_("/Options/Enable _Logging"), NULL, menu_logging_cb, 0, "<CheckItem>" }, | |
3020 { N_("/Options/Enable _Sounds"), NULL, menu_sounds_cb, 0, "<CheckItem>" }, | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3021 { N_("/Options/Show Formatting _Toolbar"), NULL, menu_toolbar_cb, 0, "<CheckItem>" }, |
4359 | 3022 }; |
3023 | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
3024 static const int menu_item_count = |
4359 | 3025 sizeof(menu_items) / sizeof(*menu_items); |
3026 | |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3027 static char * |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3028 item_factory_translate_func (const char *path, gpointer func_data) |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3029 { |
7386 | 3030 return _((char *)path); |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3031 } |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3032 |
4359 | 3033 static GtkWidget * |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3034 setup_menubar(GaimConvWindow *win) |
4359 | 3035 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3036 GaimGtkWindow *gtkwin; |
5116 | 3037 GtkAccelGroup *accel_group; |
4359 | 3038 gtkwin = GAIM_GTK_WINDOW(win); |
3039 | |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
3040 accel_group = gtk_accel_group_new (); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
3041 gtk_window_add_accel_group (GTK_WINDOW (gtkwin->window), accel_group); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
3042 g_object_unref (accel_group); |
5116 | 3043 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3044 gtkwin->menu.item_factory = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3045 gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<main>", accel_group); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3046 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3047 gtk_item_factory_set_translate_func(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3048 item_factory_translate_func, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3049 NULL, NULL); |
4630 | 3050 |
3051 gtk_item_factory_create_items(gtkwin->menu.item_factory, menu_item_count, | |
4359 | 3052 menu_items, win); |
7420 | 3053 g_signal_connect(G_OBJECT(accel_group), "accel-changed", |
3054 G_CALLBACK(gaim_gtk_save_accels_cb), NULL); | |
4359 | 3055 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3056 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3057 gtkwin->menu.menubar = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3058 gtk_item_factory_get_widget(gtkwin->menu.item_factory, "<main>"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3059 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3060 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3061 gtkwin->menu.view_log = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3062 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
7295 | 3063 N_("/Conversation/View Log")); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3064 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3065 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3066 gtkwin->menu.add_pounce = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3067 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3068 N_("/Conversation/Add Buddy Pounce...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3069 |
7879 | 3070 /* --- */ |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3071 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3072 gtkwin->menu.get_info = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3073 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
7859 | 3074 N_("/Conversation/Get Info")); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3075 |
7879 | 3076 gtkwin->menu.warn = |
3077 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3078 N_("/Conversation/Warn...")); | |
3079 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3080 gtkwin->menu.invite = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3081 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3082 N_("/Conversation/Invite...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3083 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3084 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3085 |
7879 | 3086 gtkwin->menu.alias = |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3087 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
7879 | 3088 N_("/Conversation/Alias...")); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3089 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3090 gtkwin->menu.block = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3091 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3092 N_("/Conversation/Block...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3093 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3094 gtkwin->menu.add = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3095 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3096 N_("/Conversation/Add...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3097 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3098 gtkwin->menu.remove = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3099 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3100 N_("/Conversation/Remove...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3101 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3102 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3103 |
7879 | 3104 gtkwin->menu.insert_link = |
3105 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3106 N_("/Conversation/Insert Link...")); | |
3107 | |
3108 gtkwin->menu.insert_image = | |
3109 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3110 N_("/Conversation/Insert Image...")); | |
3111 | |
3112 /* --- */ | |
3113 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3114 gtkwin->menu.logging = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3115 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3116 N_("/Options/Enable Logging")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3117 gtkwin->menu.sounds = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3118 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3119 N_("/Options/Enable Sounds")); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3120 gtkwin->menu.show_formatting_toolbar = |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3121 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3122 N_("/Options/Show Formatting Toolbar")); |
4359 | 3123 |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3124 generate_send_as_items(win, NULL); |
4359 | 3125 |
3126 gtk_widget_show(gtkwin->menu.menubar); | |
4931 | 3127 |
3128 return gtkwin->menu.menubar; | |
4359 | 3129 } |
3130 | |
3131 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3132 setup_im_buttons(GaimConversation *conv, GtkWidget *parent) |
4359 | 3133 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3134 GaimConnection *gc; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3135 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3136 GaimGtkImPane *gtkim; |
4359 | 3137 GaimConversationType type = GAIM_CONV_IM; |
3138 | |
3139 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3140 gtkim = gtkconv->u.im; | |
3141 gc = gaim_conversation_get_gc(conv); | |
3142 | |
3143 /* From right to left... */ | |
3144 | |
3145 /* Send button */ | |
3146 gtkconv->send = gaim_gtk_change_text(_("Send"), gtkconv->send, | |
3147 GAIM_STOCK_SEND, type); | |
3148 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->send, _("Send"), NULL); | |
3149 gtk_box_pack_end(GTK_BOX(parent), gtkconv->send, FALSE, FALSE, 0); | |
3150 | |
3151 /* Separator */ | |
3152 if (gtkim->sep2 != NULL) | |
3153 gtk_widget_destroy(gtkim->sep2); | |
3154 | |
3155 gtkim->sep2 = gtk_vseparator_new(); | |
3156 gtk_box_pack_end(GTK_BOX(parent), gtkim->sep2, FALSE, TRUE, 0); | |
3157 gtk_widget_show(gtkim->sep2); | |
3158 | |
3159 /* Now, um, just kind of all over the place. Huh? */ | |
3160 | |
3161 /* Warn button */ | |
3162 gtkim->warn = gaim_gtk_change_text(_("Warn"), gtkim->warn, | |
3163 GAIM_STOCK_WARN, type); | |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3164 gtk_tooltips_set_tip(gtkconv->tooltips, gtkim->warn, |
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3165 _("Warn the user"), NULL); |
7929 | 3166 gtk_box_pack_start(GTK_BOX(parent), gtkim->warn, FALSE, FALSE, 0); |
3167 | |
3168 /* Block button */ | |
3169 gtkim->block = gaim_gtk_change_text(_("Block"), gtkim->block, | |
3170 GAIM_STOCK_BLOCK, type); | |
3171 gtk_tooltips_set_tip(gtkconv->tooltips, gtkim->block, | |
3172 _("Block the user"), NULL); | |
3173 gtk_box_pack_start(GTK_BOX(parent), gtkim->block, FALSE, FALSE, 0); | |
3174 | |
3175 /* Add button */ | |
3176 gtkconv->add = gaim_gtk_change_text(_("Add"), gtkconv->add, | |
3177 GTK_STOCK_ADD, type); | |
3178 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->add, | |
3179 _("Add the user to your buddy list"), NULL); | |
3180 gtk_box_pack_start(GTK_BOX(parent), gtkconv->add, FALSE, FALSE, 0); | |
3181 | |
3182 /* Remove button */ | |
3183 gtkconv->remove = gaim_gtk_change_text(_("Remove"), gtkconv->remove, | |
3184 GTK_STOCK_REMOVE, type); | |
3185 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->remove, | |
3186 _("Remove the user from your buddy list"), NULL); | |
3187 gtk_box_pack_start(GTK_BOX(parent), gtkconv->remove, FALSE, FALSE, 0); | |
4359 | 3188 |
3189 /* Info button */ | |
3190 gtkconv->info = gaim_gtk_change_text(_("Info"), gtkconv->info, | |
3191 GAIM_STOCK_INFO, type); | |
3192 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->info, | |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3193 _("Get the user's information"), NULL); |
7929 | 3194 gtk_box_pack_start(GTK_BOX(parent), gtkconv->info, FALSE, FALSE, 0); |
3195 | |
3196 gtk_button_set_relief(GTK_BUTTON(gtkim->warn), GTK_RELIEF_NONE); | |
3197 gtk_button_set_relief(GTK_BUTTON(gtkim->block), GTK_RELIEF_NONE); | |
3198 gtk_button_set_relief(GTK_BUTTON(gtkconv->add), GTK_RELIEF_NONE); | |
3199 gtk_button_set_relief(GTK_BUTTON(gtkconv->remove), GTK_RELIEF_NONE); | |
4359 | 3200 gtk_button_set_relief(GTK_BUTTON(gtkconv->info), GTK_RELIEF_NONE); |
3201 gtk_button_set_relief(GTK_BUTTON(gtkconv->send), GTK_RELIEF_NONE); | |
7929 | 3202 |
3203 gtk_size_group_add_widget(gtkconv->sg, gtkim->warn); | |
3204 gtk_size_group_add_widget(gtkconv->sg, gtkim->block); | |
3205 gtk_size_group_add_widget(gtkconv->sg, gtkconv->add); | |
3206 gtk_size_group_add_widget(gtkconv->sg, gtkconv->remove); | |
4359 | 3207 gtk_size_group_add_widget(gtkconv->sg, gtkconv->info); |
3208 gtk_size_group_add_widget(gtkconv->sg, gtkconv->send); | |
7929 | 3209 |
3210 gtk_box_reorder_child(GTK_BOX(parent), gtkim->warn, 1); | |
3211 gtk_box_reorder_child(GTK_BOX(parent), gtkim->block, 2); | |
3212 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->add, 3); | |
3213 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->remove, 4); | |
3214 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->info, 5); | |
4359 | 3215 |
3216 gaim_gtkconv_update_buttons_by_protocol(conv); | |
3217 | |
3218 g_signal_connect(G_OBJECT(gtkim->warn), "clicked", | |
3219 G_CALLBACK(warn_cb), conv); | |
3220 g_signal_connect(G_OBJECT(gtkim->block), "clicked", | |
3221 G_CALLBACK(block_cb), conv); | |
7929 | 3222 g_signal_connect(G_OBJECT(gtkconv->add), "clicked", |
3223 G_CALLBACK(add_remove_cb), conv); | |
3224 g_signal_connect(G_OBJECT(gtkconv->remove), "clicked", | |
3225 G_CALLBACK(add_remove_cb), conv); | |
3226 g_signal_connect(G_OBJECT(gtkconv->info), "clicked", | |
3227 G_CALLBACK(info_cb), conv); | |
3228 g_signal_connect(G_OBJECT(gtkconv->send), "clicked", | |
3229 G_CALLBACK(send_cb), conv); | |
4359 | 3230 } |
3231 | |
3232 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3233 setup_chat_buttons(GaimConversation *conv, GtkWidget *parent) |
4359 | 3234 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3235 GaimConnection *gc; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3236 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3237 GaimGtkChatPane *gtkchat; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3238 GaimGtkWindow *gtkwin; |
4359 | 3239 GtkWidget *sep; |
3240 | |
3241 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3242 gtkchat = gtkconv->u.chat; | |
3243 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); | |
3244 gc = gaim_conversation_get_gc(conv); | |
3245 | |
3246 /* Send button */ | |
3247 gtkconv->send = gaim_gtk_change_text(_("Send"), gtkconv->send, | |
3248 GAIM_STOCK_SEND, GAIM_CONV_CHAT); | |
3249 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->send, _("Send"), NULL); | |
3250 gtk_box_pack_end(GTK_BOX(parent), gtkconv->send, FALSE, FALSE, 0); | |
3251 | |
3252 /* Separator */ | |
3253 sep = gtk_vseparator_new(); | |
3254 gtk_box_pack_end(GTK_BOX(parent), sep, FALSE, TRUE, 0); | |
3255 gtk_widget_show(sep); | |
3256 | |
3257 /* Invite */ | |
3258 gtkchat->invite = gaim_gtk_change_text(_("Invite"), gtkchat->invite, | |
3259 GAIM_STOCK_INVITE, GAIM_CONV_CHAT); | |
3260 gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->invite, | |
3261 _("Invite a user"), NULL); | |
7931 | 3262 gtk_box_pack_start(GTK_BOX(parent), gtkchat->invite, FALSE, FALSE, 0); |
4359 | 3263 |
7929 | 3264 /* Add button */ |
3265 gtkconv->add = gaim_gtk_change_text(_("Add"), gtkconv->add, | |
3266 GTK_STOCK_ADD, GAIM_CONV_CHAT); | |
3267 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->add, | |
3268 _("Add the chat to your buddy list"), NULL); | |
3269 gtk_box_pack_start(GTK_BOX(parent), gtkconv->add, FALSE, FALSE, 0); | |
3270 | |
3271 /* Remove button */ | |
3272 gtkconv->remove = gaim_gtk_change_text(_("Remove"), gtkconv->remove, | |
3273 GTK_STOCK_REMOVE, GAIM_CONV_CHAT); | |
3274 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->remove, | |
3275 _("Remove the chat from your buddy list"), NULL); | |
3276 gtk_box_pack_start(GTK_BOX(parent), gtkconv->remove, FALSE, FALSE, 0); | |
3277 | |
4359 | 3278 /* Set the relief on these. */ |
3279 gtk_button_set_relief(GTK_BUTTON(gtkchat->invite), GTK_RELIEF_NONE); | |
7929 | 3280 gtk_button_set_relief(GTK_BUTTON(gtkconv->add), GTK_RELIEF_NONE); |
3281 gtk_button_set_relief(GTK_BUTTON(gtkconv->remove), GTK_RELIEF_NONE); | |
4359 | 3282 gtk_button_set_relief(GTK_BUTTON(gtkconv->send), GTK_RELIEF_NONE); |
3283 | |
3284 /* Callbacks */ | |
7929 | 3285 g_signal_connect(G_OBJECT(gtkchat->invite), "clicked", |
3286 G_CALLBACK(invite_cb), conv); | |
3287 g_signal_connect(G_OBJECT(gtkconv->add), "clicked", | |
3288 G_CALLBACK(add_remove_cb), conv); | |
3289 g_signal_connect(G_OBJECT(gtkconv->remove), "clicked", | |
3290 G_CALLBACK(add_remove_cb), conv); | |
4359 | 3291 g_signal_connect(G_OBJECT(gtkconv->send), "clicked", |
3292 G_CALLBACK(send_cb), conv); | |
3293 } | |
3294 | |
3295 static GtkWidget * | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3296 build_conv_toolbar(GaimConversation *conv) |
4359 | 3297 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3298 GaimGtkConversation *gtkconv; |
4359 | 3299 GtkWidget *vbox; |
3300 GtkWidget *hbox; | |
3301 GtkWidget *button; | |
3302 GtkWidget *sep; | |
3303 GtkSizeGroup *sg; | |
3304 | |
3305 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3306 | |
3307 sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); | |
3308 | |
3309 vbox = gtk_vbox_new(FALSE, 0); | |
3310 sep = gtk_hseparator_new(); | |
3311 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); | |
3312 | |
3313 hbox = gtk_hbox_new(FALSE, 5); | |
3314 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
3315 | |
3316 /* Bold */ | |
3317 button = gaim_pixbuf_toolbar_button_from_stock(GTK_STOCK_BOLD); | |
3318 gtk_size_group_add_widget(sg, button); | |
3319 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3320 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("Bold"), NULL); | |
3321 | |
3322 g_signal_connect(G_OBJECT(button), "clicked", | |
3323 G_CALLBACK(do_bold), gtkconv); | |
3324 | |
3325 gtkconv->toolbar.bold = button; | |
3326 | |
3327 /* Italic */ | |
3328 button = gaim_pixbuf_toolbar_button_from_stock(GTK_STOCK_ITALIC); | |
3329 gtk_size_group_add_widget(sg, button); | |
3330 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3331 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("Italic"), NULL); | |
3332 | |
3333 g_signal_connect(G_OBJECT(button), "clicked", | |
3334 G_CALLBACK(do_italic), gtkconv); | |
3335 | |
3336 gtkconv->toolbar.italic = button; | |
3337 | |
3338 /* Underline */ | |
3339 button = gaim_pixbuf_toolbar_button_from_stock(GTK_STOCK_UNDERLINE); | |
3340 gtk_size_group_add_widget(sg, button); | |
3341 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3342 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("Underline"), NULL); | |
3343 | |
3344 g_signal_connect(G_OBJECT(button), "clicked", | |
3345 G_CALLBACK(do_underline), gtkconv); | |
3346 | |
3347 gtkconv->toolbar.underline = button; | |
3348 | |
3349 /* Sep */ | |
3350 sep = gtk_vseparator_new(); | |
3351 gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 0); | |
3352 | |
3353 /* Increase font size */ | |
3354 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_TEXT_BIGGER); | |
3355 gtk_size_group_add_widget(sg, button); | |
3356 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3357 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
3358 _("Larger font size"), NULL); | |
3359 | |
3360 g_signal_connect(G_OBJECT(button), "clicked", | |
3361 G_CALLBACK(do_big), gtkconv); | |
3362 | |
5049 | 3363 gtkconv->toolbar.larger_size = button; |
3364 | |
7740 | 3365 /* Normal font size |
4359 | 3366 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_TEXT_NORMAL); |
3367 gtk_size_group_add_widget(sg, button); | |
3368 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3369 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
3370 _("Normal font size"), NULL); | |
3371 | |
3372 g_signal_connect(G_OBJECT(button), "clicked", | |
3373 G_CALLBACK(do_normal), gtkconv); | |
3374 | |
3375 gtkconv->toolbar.normal_size = button; | |
7740 | 3376 */ |
4359 | 3377 |
3378 /* Decrease font size */ | |
3379 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_TEXT_SMALLER); | |
3380 gtk_size_group_add_widget(sg, button); | |
3381 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3382 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
3383 _("Smaller font size"), NULL); | |
3384 | |
3385 g_signal_connect(G_OBJECT(button), "clicked", | |
3386 G_CALLBACK(do_small), gtkconv); | |
3387 | |
5049 | 3388 gtkconv->toolbar.smaller_size = button; |
3389 | |
4359 | 3390 /* Sep */ |
3391 sep = gtk_vseparator_new(); | |
3392 gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 0); | |
3393 | |
4685 | 3394 /* Font Face */ |
3395 | |
3396 button = gaim_pixbuf_toolbar_button_from_stock(GTK_STOCK_SELECT_FONT); | |
3397 gtk_size_group_add_widget(sg, button); | |
3398 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3399 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
3400 _("Font Face"), NULL); | |
3401 | |
3402 g_signal_connect(G_OBJECT(button), "clicked", | |
3403 G_CALLBACK(toggle_font), conv); | |
3404 | |
3405 gtkconv->toolbar.font = button; | |
3406 | |
4359 | 3407 /* Foreground Color */ |
3408 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_FGCOLOR); | |
3409 gtk_size_group_add_widget(sg, button); | |
3410 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3411 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
3412 _("Foreground font color"), NULL); | |
3413 | |
3414 g_signal_connect(G_OBJECT(button), "clicked", | |
3415 G_CALLBACK(toggle_fg_color), conv); | |
3416 | |
3417 gtkconv->toolbar.fgcolor = button; | |
3418 | |
3419 /* Background Color */ | |
3420 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_BGCOLOR); | |
3421 gtk_size_group_add_widget(sg, button); | |
3422 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3423 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
3424 _("Background color"), NULL); | |
3425 | |
3426 g_signal_connect(G_OBJECT(button), "clicked", | |
3427 G_CALLBACK(toggle_bg_color), conv); | |
3428 | |
3429 gtkconv->toolbar.bgcolor = button; | |
3430 | |
3431 /* Sep */ | |
3432 sep = gtk_vseparator_new(); | |
3433 gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 0); | |
3434 | |
7927 | 3435 /* Insert Link */ |
3436 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_LINK); | |
3437 gtk_size_group_add_widget(sg, button); | |
3438 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3439 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("Insert link"), NULL); | |
3440 | |
3441 g_signal_connect(G_OBJECT(button), "clicked", | |
3442 G_CALLBACK(insert_link_cb), conv); | |
3443 | |
3444 gtkconv->toolbar.link = button; | |
3445 | |
4359 | 3446 /* Insert IM Image */ |
3447 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_IMAGE); | |
3448 gtk_size_group_add_widget(sg, button); | |
3449 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3450 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("Insert image"), NULL); | |
3451 | |
3452 g_signal_connect(G_OBJECT(button), "clicked", | |
3453 G_CALLBACK(insert_image_cb), conv); | |
3454 | |
3455 gtkconv->toolbar.image = button; | |
3456 | |
3457 /* Insert Smiley */ | |
3458 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_SMILEY); | |
3459 gtk_size_group_add_widget(sg, button); | |
3460 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3461 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("Insert smiley"), NULL); | |
3462 | |
3463 g_signal_connect(G_OBJECT(button), "clicked", | |
3464 G_CALLBACK(insert_smiley_cb), conv); | |
3465 | |
3466 gtkconv->toolbar.smiley = button; | |
3467 | |
3468 | |
3469 sep = gtk_hseparator_new(); | |
3470 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); | |
3471 | |
3472 gtk_widget_show_all(vbox); | |
3473 | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3474 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/show_formatting_toolbar")) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3475 gtk_widget_hide(vbox); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3476 |
4359 | 3477 return vbox; |
3478 } | |
3479 | |
3480 static GtkWidget * | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3481 setup_chat_pane(GaimConversation *conv) |
4359 | 3482 { |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3483 GaimPluginProtocolInfo *prpl_info = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3484 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3485 GaimGtkChatPane *gtkchat; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3486 GaimConnection *gc; |
4359 | 3487 GtkWidget *vpaned, *hpaned; |
3488 GtkWidget *vbox, *hbox; | |
3489 GtkWidget *lbox, *bbox; | |
3490 GtkWidget *label; | |
3491 GtkWidget *list; | |
3492 GtkWidget *button; | |
7949 | 3493 GtkWidget *sw; |
4359 | 3494 GtkListStore *ls; |
3495 GtkCellRenderer *rend; | |
3496 GtkTreeViewColumn *col; | |
3497 | |
3498 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3499 gtkchat = gtkconv->u.chat; | |
3500 gc = gaim_conversation_get_gc(conv); | |
3501 | |
3502 /* Setup the outer pane. */ | |
3503 vpaned = gtk_vpaned_new(); | |
3504 gtk_widget_show(vpaned); | |
3505 | |
3506 /* Setup the top part of the pane. */ | |
3507 vbox = gtk_vbox_new(FALSE, 5); | |
3508 gtk_paned_pack1(GTK_PANED(vpaned), vbox, TRUE, FALSE); | |
3509 gtk_widget_show(vbox); | |
3510 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3511 if (gc != NULL) |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3512 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3513 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3514 if (prpl_info->options & OPT_PROTO_CHAT_TOPIC) |
4359 | 3515 { |
3516 hbox = gtk_hbox_new(FALSE, 0); | |
3517 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
3518 gtk_widget_show(hbox); | |
3519 | |
3520 label = gtk_label_new(_("Topic:")); | |
3521 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
3522 gtk_widget_show(label); | |
3523 | |
3524 gtkchat->topic_text = gtk_entry_new(); | |
4635 | 3525 gtk_editable_set_editable(GTK_EDITABLE(gtkchat->topic_text), FALSE); |
4359 | 3526 gtk_box_pack_start(GTK_BOX(hbox), gtkchat->topic_text, TRUE, TRUE, 5); |
3527 gtk_widget_show(gtkchat->topic_text); | |
3528 } | |
3529 | |
3530 /* Setup the horizontal pane. */ | |
3531 hpaned = gtk_hpaned_new(); | |
3532 gtk_box_pack_start(GTK_BOX(vbox), hpaned, TRUE, TRUE, 5); | |
3533 gtk_widget_show(hpaned); | |
3534 | |
3535 /* Setup the scrolled window to put gtkimhtml in. */ | |
3536 gtkconv->sw = gtk_scrolled_window_new(NULL, NULL); | |
3537 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
3538 GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); | |
3539 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
3540 GTK_SHADOW_IN); | |
3541 gtk_paned_pack1(GTK_PANED(hpaned), gtkconv->sw, TRUE, TRUE); | |
3542 | |
3543 gtk_widget_set_size_request(gtkconv->sw, | |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3544 gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_width"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3545 gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_height")); |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3546 |
4359 | 3547 gtk_widget_show(gtkconv->sw); |
3548 | |
3549 /* Setup gtkihmtml. */ | |
3550 gtkconv->imhtml = gtk_imhtml_new(NULL, NULL); | |
3551 gtk_container_add(GTK_CONTAINER(gtkconv->sw), gtkconv->imhtml); | |
3552 | |
3553 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3554 gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); |
4359 | 3555 |
3556 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", | |
3557 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
6057 | 3558 g_signal_connect(G_OBJECT(gtkconv->imhtml), "button_release_event", |
3559 G_CALLBACK(refocus_entry_cb), gtkconv); | |
4359 | 3560 |
3561 gaim_setup_imhtml(gtkconv->imhtml); | |
3562 | |
3563 gtk_widget_show(gtkconv->imhtml); | |
3564 | |
3565 /* Build the right pane. */ | |
3566 lbox = gtk_vbox_new(FALSE, 5); | |
4409
0521eec12c33
[gaim-migrate @ 4682]
Christian Hammond <chipx86@chipx86.com>
parents:
4398
diff
changeset
|
3567 gtk_paned_pack2(GTK_PANED(hpaned), lbox, FALSE, TRUE); |
4359 | 3568 gtk_widget_show(lbox); |
3569 | |
3570 /* Setup the label telling how many people are in the room. */ | |
3571 gtkchat->count = gtk_label_new(_("0 people in room")); | |
3572 gtk_box_pack_start(GTK_BOX(lbox), gtkchat->count, FALSE, FALSE, 0); | |
3573 gtk_widget_show(gtkchat->count); | |
3574 | |
3575 /* Setup the list of users. */ | |
7949 | 3576 sw = gtk_scrolled_window_new(NULL, NULL); |
3577 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
4359 | 3578 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); |
7949 | 3579 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); |
3580 gtk_box_pack_start(GTK_BOX(lbox), sw, TRUE, TRUE, 0); | |
3581 gtk_widget_show(sw); | |
4359 | 3582 |
3583 ls = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING); | |
3584 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), 1, | |
3585 GTK_SORT_ASCENDING); | |
3586 | |
3587 list = gtk_tree_view_new_with_model(GTK_TREE_MODEL(ls)); | |
3588 | |
3589 rend = gtk_cell_renderer_text_new(); | |
3590 col = gtk_tree_view_column_new_with_attributes(NULL, rend, | |
3591 "text", 0, NULL); | |
3592 gtk_tree_view_column_set_clickable(GTK_TREE_VIEW_COLUMN(col), TRUE); | |
3593 | |
3594 g_signal_connect(G_OBJECT(list), "button_press_event", | |
3595 G_CALLBACK(right_click_chat_cb), conv); | |
3596 | |
3597 gtk_tree_view_append_column(GTK_TREE_VIEW(list), col); | |
3598 | |
3599 col = gtk_tree_view_column_new_with_attributes(NULL, rend, | |
3600 "text", 1, NULL); | |
3601 gtk_tree_view_column_set_clickable(GTK_TREE_VIEW_COLUMN(col), TRUE); | |
3602 | |
3603 gtk_tree_view_append_column(GTK_TREE_VIEW(list), col); | |
3604 | |
3605 gtk_widget_set_size_request(list, 150, -1); | |
3606 | |
3607 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(list), FALSE); | |
3608 gtk_widget_show(list); | |
3609 | |
3610 gtkchat->list = list; | |
3611 | |
7949 | 3612 gtk_container_add(GTK_CONTAINER(sw), list); |
4359 | 3613 |
3614 /* Setup the user list toolbar. */ | |
3615 bbox = gtk_hbox_new(TRUE, 5); | |
3616 gtk_box_pack_start(GTK_BOX(lbox), bbox, FALSE, FALSE, 0); | |
3617 gtk_widget_show(bbox); | |
3618 | |
3619 /* IM */ | |
3620 button = gaim_pixbuf_button_from_stock(NULL, GTK_STOCK_REDO, | |
3621 GAIM_BUTTON_VERTICAL); | |
3622 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
3623 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
|
3624 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("IM the user"), NULL); |
4359 | 3625 g_signal_connect(G_OBJECT(button), "clicked", |
7961 | 3626 G_CALLBACK(chat_im_button_cb), conv); |
4359 | 3627 |
3628 gtk_widget_show(button); | |
3629 | |
3630 /* Ignore */ | |
3631 button = gaim_pixbuf_button_from_stock(NULL, GAIM_STOCK_IGNORE, | |
3632 GAIM_BUTTON_VERTICAL); | |
3633 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
3634 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
|
3635 gtk_tooltips_set_tip(gtkconv->tooltips, button, |
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3636 _("Ignore the user"), NULL); |
4359 | 3637 g_signal_connect(G_OBJECT(button), "clicked", |
3638 G_CALLBACK(ignore_cb), conv); | |
3639 gtk_widget_show(button); | |
3640 | |
3641 /* Info */ | |
3642 button = gaim_pixbuf_button_from_stock(NULL, GAIM_STOCK_INFO, | |
3643 GAIM_BUTTON_VERTICAL); | |
3644 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
3645 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
3646 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3647 _("Get the user's information"), NULL); |
4359 | 3648 g_signal_connect(G_OBJECT(button), "clicked", |
3649 G_CALLBACK(info_cb), conv); | |
3650 | |
3651 gtk_widget_show(button); | |
3652 | |
3653 gtkconv->info = button; | |
3654 | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3655 /* Build the toolbar. */ |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3656 vbox = gtk_vbox_new(FALSE, 5); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3657 gtk_paned_pack2(GTK_PANED(vpaned), vbox, FALSE, FALSE); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3658 gtk_widget_show(vbox); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3659 |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3660 gtkconv->toolbar.toolbar = build_conv_toolbar(conv); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3661 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->toolbar.toolbar, |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3662 FALSE, FALSE, 0); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3663 |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3664 /* Setup the entry widget. */ |
7949 | 3665 sw = gtk_scrolled_window_new(NULL, NULL); |
3666 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
3667 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); | |
3668 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), | |
3669 GTK_SHADOW_IN); | |
3670 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); | |
3671 gtk_widget_show(sw); | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3672 |
7700 | 3673 gtkconv->entry = gtk_imhtml_new(NULL, NULL); |
3674 gtkconv->entry_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); | |
7949 | 3675 gaim_setup_imhtml(gtkconv->entry); |
7700 | 3676 gtk_imhtml_set_editable(GTK_IMHTML(gtkconv->entry), TRUE); |
7766 | 3677 default_formatize(conv); |
5105 | 3678 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
|
3679 gtk_widget_set_size_request(gtkconv->entry, -1, |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3680 MAX(gaim_prefs_get_int("/gaim/gtk/conversations/chat/entry_height"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3681 25)); |
7949 | 3682 g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", conv); |
3683 | |
4359 | 3684 g_signal_connect_swapped(G_OBJECT(gtkconv->entry), "key_press_event", |
3685 G_CALLBACK(entry_key_pressed_cb_1), | |
3686 gtkconv->entry_buffer); | |
7949 | 3687 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", |
3688 G_CALLBACK(entry_key_pressed_cb_2), conv); | |
4359 | 3689 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", |
3690 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
3691 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3692 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
3693 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
4359 | 3694 |
7949 | 3695 gtk_container_add(GTK_CONTAINER(sw), GTK_WIDGET(gtkconv->entry)); |
4359 | 3696 gtk_widget_show(gtkconv->entry); |
3697 | |
3698 /* Setup the bottom button box. */ | |
3699 gtkconv->bbox = gtk_hbox_new(FALSE, 5); | |
3700 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->bbox, FALSE, FALSE, 0); | |
3701 gtk_widget_show(gtkconv->bbox); | |
3702 | |
3703 setup_chat_buttons(conv, gtkconv->bbox); | |
3704 | |
3705 return vpaned; | |
3706 } | |
3707 | |
3708 static GtkWidget * | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3709 setup_im_pane(GaimConversation *conv) |
4359 | 3710 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3711 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3712 GaimGtkImPane *gtkim; |
4359 | 3713 GtkWidget *paned; |
3714 GtkWidget *vbox; | |
3715 GtkWidget *vbox2; | |
7949 | 3716 GtkWidget *sw; |
4359 | 3717 |
3718 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3719 gtkim = gtkconv->u.im; | |
3720 | |
3721 /* Setup the outer pane. */ | |
3722 paned = gtk_vpaned_new(); | |
3723 gtk_widget_show(paned); | |
3724 | |
3725 /* Setup the top part of the pane. */ | |
3726 vbox = gtk_vbox_new(FALSE, 5); | |
4409
0521eec12c33
[gaim-migrate @ 4682]
Christian Hammond <chipx86@chipx86.com>
parents:
4398
diff
changeset
|
3727 gtk_paned_pack1(GTK_PANED(paned), vbox, TRUE, TRUE); |
4359 | 3728 gtk_widget_show(vbox); |
3729 | |
3730 /* Setup the gtkimhtml widget. */ | |
3731 gtkconv->sw = gtk_scrolled_window_new(NULL, NULL); | |
3732 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
3733 GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); | |
3734 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
3735 GTK_SHADOW_IN); | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3736 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->sw, TRUE, TRUE, 0); |
4851 | 3737 |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3738 gtk_widget_set_size_request(gtkconv->sw, |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3739 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_width"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3740 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_height")); |
4359 | 3741 gtk_widget_show(gtkconv->sw); |
3742 | |
3743 gtkconv->imhtml = gtk_imhtml_new(NULL, NULL); | |
3744 gtk_container_add(GTK_CONTAINER(gtkconv->sw), gtkconv->imhtml); | |
3745 | |
3746 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", | |
3747 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
6057 | 3748 g_signal_connect(G_OBJECT(gtkconv->imhtml), "button_release_event", |
3749 G_CALLBACK(refocus_entry_cb), gtkconv); | |
4359 | 3750 |
3751 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3752 gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); |
4359 | 3753 |
3754 gaim_setup_imhtml(gtkconv->imhtml); | |
3755 gtk_widget_show(gtkconv->imhtml); | |
3756 | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3757 vbox2 = gtk_vbox_new(FALSE, 5); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3758 gtk_paned_pack2(GTK_PANED(paned), vbox2, FALSE, FALSE); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3759 gtk_widget_show(vbox2); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3760 |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3761 /* Build the toolbar. */ |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3762 gtkconv->toolbar.toolbar = build_conv_toolbar(conv); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3763 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->toolbar.toolbar, |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3764 FALSE, FALSE, 0); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3765 |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3766 /* Setup the entry widget. */ |
7949 | 3767 sw = gtk_scrolled_window_new(NULL, NULL); |
3768 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
3769 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); | |
3770 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), | |
3771 GTK_SHADOW_IN); | |
3772 gtk_box_pack_start(GTK_BOX(vbox2), sw, TRUE, TRUE, 0); | |
3773 gtk_widget_show(sw); | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3774 |
7695 | 3775 gtkconv->entry = gtk_imhtml_new(NULL, NULL); |
7949 | 3776 gtkconv->entry_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); |
3777 gaim_setup_imhtml(gtkconv->entry); | |
7695 | 3778 gtk_imhtml_set_editable(GTK_IMHTML(gtkconv->entry), TRUE); |
7766 | 3779 default_formatize(conv); |
5105 | 3780 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
|
3781 gtk_widget_set_size_request(gtkconv->entry, -1, |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3782 MAX(gaim_prefs_get_int("/gaim/gtk/conversations/im/entry_height"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3783 25)); |
7949 | 3784 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
|
3785 |
4359 | 3786 g_signal_connect_swapped(G_OBJECT(gtkconv->entry), "key_press_event", |
3787 G_CALLBACK(entry_key_pressed_cb_1), | |
3788 gtkconv->entry_buffer); | |
3789 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", | |
3790 G_CALLBACK(entry_key_pressed_cb_2), conv); | |
3791 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", | |
3792 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
3793 | |
3794 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "insert_text", | |
3795 G_CALLBACK(insert_text_cb), conv); | |
3796 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "delete_range", | |
3797 G_CALLBACK(delete_text_cb), conv); | |
3798 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3799 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
3800 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
4359 | 3801 |
7949 | 3802 gtk_container_add(GTK_CONTAINER(sw), GTK_WIDGET(gtkconv->entry)); |
4359 | 3803 gtk_widget_show(gtkconv->entry); |
3804 | |
3805 gtkconv->bbox = gtk_hbox_new(FALSE, 5); | |
3806 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->bbox, FALSE, FALSE, 0); | |
3807 gtk_widget_show(gtkconv->bbox); | |
3808 | |
3809 setup_im_buttons(conv, gtkconv->bbox); | |
3810 | |
3811 return paned; | |
3812 } | |
3813 | |
3814 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3815 move_next_tab(GaimConversation *conv) |
4359 | 3816 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3817 GaimConversation *next_conv = NULL; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3818 GaimConvWindow *win; |
4359 | 3819 GList *l; |
3820 int index, i; | |
3821 | |
3822 win = gaim_conversation_get_window(conv); | |
3823 index = gaim_conversation_get_index(conv); | |
3824 | |
3825 /* First check the tabs after this position. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3826 for (l = g_list_nth(gaim_conv_window_get_conversations(win), index); |
4359 | 3827 l != NULL; |
3828 l = l->next) { | |
3829 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3830 next_conv = (GaimConversation *)l->data; |
4359 | 3831 |
3832 if (gaim_conversation_get_unseen(next_conv) > 0) | |
3833 break; | |
3834 | |
3835 next_conv = NULL; | |
3836 } | |
3837 | |
3838 if (next_conv == NULL) { | |
3839 | |
3840 /* Now check before this position. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3841 for (l = gaim_conv_window_get_conversations(win), i = 0; |
4359 | 3842 l != NULL && i < index; |
3843 l = l->next) { | |
3844 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3845 next_conv = (GaimConversation *)l->data; |
4359 | 3846 |
3847 if (gaim_conversation_get_unseen(next_conv) > 0) | |
3848 break; | |
3849 | |
3850 next_conv = NULL; | |
3851 } | |
3852 | |
3853 if (next_conv == NULL) { | |
3854 /* Okay, just grab the next conversation tab. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3855 if (index == gaim_conv_window_get_conversation_count(win) - 1) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3856 next_conv = gaim_conv_window_get_conversation_at(win, 0); |
4359 | 3857 else |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3858 next_conv = gaim_conv_window_get_conversation_at(win, index + 1); |
4359 | 3859 } |
3860 } | |
3861 | |
3862 if (next_conv != NULL && next_conv != conv) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3863 gaim_conv_window_switch_conversation(win, |
4359 | 3864 gaim_conversation_get_index(next_conv)); |
3865 } | |
3866 } | |
3867 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3868 static void |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3869 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
|
3870 GtkSelectionData *sd, guint info, guint t, |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3871 GaimConversation *conv) |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3872 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3873 GaimConvWindow *win = conv->window; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3874 GaimConversation *c; |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3875 |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3876 if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE)) |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3877 { |
4781 | 3878 GaimBlistNode *n = NULL; |
6695 | 3879 GaimBuddy *b; |
4781 | 3880 memcpy(&n, sd->data, sizeof(n)); |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3881 |
6695 | 3882 if (GAIM_BLIST_NODE_IS_CONTACT(n)) |
3883 b = gaim_contact_get_priority_buddy((GaimContact*)n); | |
3884 else if (GAIM_BLIST_NODE_IS_BUDDY(n)) | |
3885 b = (GaimBuddy*)n; | |
3886 else | |
4781 | 3887 return; |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3888 |
7089
2cd3756a637b
[gaim-migrate @ 7654]
Christian Hammond <chipx86@chipx86.com>
parents:
7078
diff
changeset
|
3889 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
|
3890 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3891 gaim_conv_window_add_conversation(win, c); |
4702 | 3892 } |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3893 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
|
3894 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3895 char *protocol = NULL; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3896 char *username = NULL; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3897 GaimAccount *account; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3898 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3899 if (gaim_gtk_parse_x_im_contact(sd->data, FALSE, &account, |
7718 | 3900 &protocol, &username, NULL)) |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3901 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3902 if (account == NULL) |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3903 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3904 gaim_notify_error(NULL, NULL, |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3905 _("You are not currently signed on with an account that " |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3906 "can add that buddy."), NULL); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3907 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3908 else |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3909 { |
7718 | 3910 c = gaim_conversation_new(GAIM_CONV_IM, account, username); |
3911 gaim_conv_window_add_conversation(win, c); | |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3912 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3913 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3914 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3915 if (username != NULL) g_free(username); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3916 if (protocol != NULL) g_free(protocol); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3917 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3918 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3919 } |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3920 } |
4359 | 3921 |
3922 /************************************************************************** | |
3923 * GTK+ window ops | |
3924 **************************************************************************/ | |
3925 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3926 gaim_gtk_new_window(GaimConvWindow *win) |
4359 | 3927 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3928 GaimGtkWindow *gtkwin; |
4359 | 3929 GtkPositionType pos; |
3930 GtkWidget *testidea; | |
3931 GtkWidget *menubar; | |
3932 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3933 gtkwin = g_malloc0(sizeof(GaimGtkWindow)); |
4359 | 3934 |
3935 win->ui_data = gtkwin; | |
3936 | |
3937 /* Create the window. */ | |
3938 gtkwin->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
3939 gtk_window_set_role(GTK_WINDOW(gtkwin->window), "conversation"); | |
4635 | 3940 gtk_window_set_resizable(GTK_WINDOW(gtkwin->window), TRUE); |
4510
4c394222c732
[gaim-migrate @ 4786]
Christian Hammond <chipx86@chipx86.com>
parents:
4505
diff
changeset
|
3941 gtk_container_set_border_width(GTK_CONTAINER(gtkwin->window), 0); |
5173 | 3942 GTK_WINDOW(gtkwin->window)->allow_shrink = TRUE; |
4359 | 3943 gtk_widget_realize(gtkwin->window); |
3944 | |
3945 g_signal_connect(G_OBJECT(gtkwin->window), "delete_event", | |
3946 G_CALLBACK(close_win_cb), win); | |
3947 | |
3948 /* Create the notebook. */ | |
3949 gtkwin->notebook = gtk_notebook_new(); | |
3950 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3951 pos = gaim_prefs_get_int("/gaim/gtk/conversations/tab_side"); |
4359 | 3952 |
3953 #if 0 | |
3954 gtk_notebook_set_tab_hborder(GTK_NOTEBOOK(gtkwin->notebook), 0); | |
3955 gtk_notebook_set_tab_vborder(GTK_NOTEBOOK(gtkwin->notebook), 0); | |
3956 #endif | |
3957 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos); | |
3958 gtk_notebook_set_scrollable(GTK_NOTEBOOK(gtkwin->notebook), TRUE); | |
3959 gtk_notebook_popup_enable(GTK_NOTEBOOK(gtkwin->notebook)); | |
4818 | 3960 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), FALSE); |
3961 | |
4359 | 3962 gtk_widget_show(gtkwin->notebook); |
3963 | |
3964 g_signal_connect_after(G_OBJECT(gtkwin->notebook), "switch_page", | |
3965 G_CALLBACK(switch_conv_cb), win); | |
3966 | |
3967 /* Setup the tab drag and drop signals. */ | |
4486 | 3968 gtk_widget_add_events(gtkwin->notebook, |
3969 GDK_BUTTON1_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK); | |
3970 g_signal_connect(G_OBJECT(gtkwin->notebook), "button_press_event", | |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
3971 G_CALLBACK(notebook_press_cb), win); |
4486 | 3972 g_signal_connect(G_OBJECT(gtkwin->notebook), "button_release_event", |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
3973 G_CALLBACK(notebook_release_cb), win); |
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
3974 |
4359 | 3975 testidea = gtk_vbox_new(FALSE, 0); |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
3976 |
4359 | 3977 /* Setup the menubar. */ |
3978 menubar = setup_menubar(win); | |
3979 gtk_box_pack_start(GTK_BOX(testidea), menubar, FALSE, TRUE, 0); | |
3980 | |
3981 gtk_box_pack_start(GTK_BOX(testidea), gtkwin->notebook, TRUE, TRUE, 0); | |
3982 | |
3983 gtk_container_add(GTK_CONTAINER(gtkwin->window), testidea); | |
3984 | |
3985 gtk_widget_show(testidea); | |
3986 } | |
3987 | |
3988 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3989 gaim_gtk_destroy_window(GaimConvWindow *win) |
4359 | 3990 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3991 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 3992 |
3993 gtk_widget_destroy(gtkwin->window); | |
3994 | |
4630 | 3995 g_object_unref(G_OBJECT(gtkwin->menu.item_factory)); |
3996 | |
4359 | 3997 g_free(gtkwin); |
3998 win->ui_data = NULL; | |
3999 } | |
4000 | |
4001 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4002 gaim_gtk_show(GaimConvWindow *win) |
4359 | 4003 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4004 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4005 |
4006 gtk_widget_show(gtkwin->window); | |
7413 | 4007 |
4008 #ifdef _WIN32 | |
7415 | 4009 /* This works around a win32 gtk+ bug, where it can't handle |
4010 * creating the button correctly before the window is shown. | |
4011 * That's why we get the appearance of a button, without all | |
4012 * the normal button-like properties, like being able to click | |
7413 | 4013 * it. ;-) --Nathan */ |
7414 | 4014 if (gaim_prefs_get_bool("/gaim/gtk/conversations/close_on_tabs")) { |
4015 GaimConversation *conv; | |
4016 GaimGtkConversation *gtkconv; | |
4017 | |
4018 conv = gaim_conv_window_get_conversation_at(win, 0); | |
4019 if(conv) { | |
4020 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7415 | 4021 gtk_widget_hide(gtkconv->close); |
7414 | 4022 gtk_widget_show_all(gtkconv->close); |
4023 } | |
4024 } | |
7413 | 4025 #endif |
4359 | 4026 } |
4027 | |
4028 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4029 gaim_gtk_hide(GaimConvWindow *win) |
4359 | 4030 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4031 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4032 |
4033 gtk_widget_hide(gtkwin->window); | |
4034 } | |
4035 | |
4036 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4037 gaim_gtk_raise(GaimConvWindow *win) |
4359 | 4038 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4039 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4040 |
5484 | 4041 gtk_widget_show(gtkwin->window); |
5103 | 4042 gtk_window_deiconify(GTK_WINDOW(gtkwin->window)); |
4526 | 4043 gdk_window_raise(gtkwin->window->window); |
4359 | 4044 } |
4045 | |
4046 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4047 gaim_gtk_flash(GaimConvWindow *win) |
4359 | 4048 { |
4049 #ifdef _WIN32 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4050 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4051 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4052 wgaim_conv_im_blink(gtkwin->window); |
4359 | 4053 #endif |
4054 } | |
4055 | |
4056 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4057 gaim_gtk_switch_conversation(GaimConvWindow *win, unsigned int index) |
4359 | 4058 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4059 GaimGtkWindow *gtkwin; |
4359 | 4060 |
4061 gtkwin = GAIM_GTK_WINDOW(win); | |
4062 | |
4063 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), index); | |
4064 } | |
4065 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4066 static const GtkTargetEntry te[] = |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4067 { |
7695 | 4068 {"text/plain", 0, 0}, |
4069 {"text/uri-list", 0, 1}, | |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4070 {"GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, 2}, |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4071 {"STRING", 0, 3}, |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4072 {"application/x-im-contact", 0, 4} |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4073 }; |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4074 |
4359 | 4075 static void |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4076 gaim_gtk_add_conversation(GaimConvWindow *win, GaimConversation *conv) |
4359 | 4077 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4078 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4079 GaimGtkConversation *gtkconv, *focus_gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4080 GaimConversation *focus_conv; |
4359 | 4081 GtkWidget *pane = NULL; |
4082 GtkWidget *tab_cont; | |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4083 GtkWidget *tabby, *menu_tabby; |
4359 | 4084 gboolean new_ui; |
4383
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4085 GaimConversationType conv_type; |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4086 const char *name; |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4087 |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4088 name = gaim_conversation_get_name(conv); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4089 conv_type = gaim_conversation_get_type(conv); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4090 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4091 |
4092 if (conv->ui_data != NULL) { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4093 gtkconv = (GaimGtkConversation *)conv->ui_data; |
4359 | 4094 |
4095 tab_cont = gtkconv->tab_cont; | |
4096 | |
4097 new_ui = FALSE; | |
4098 } | |
4099 else { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4100 gtkconv = g_malloc0(sizeof(GaimGtkConversation)); |
4359 | 4101 conv->ui_data = gtkconv; |
4102 | |
4103 /* Setup some initial variables. */ | |
4104 gtkconv->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
4105 gtkconv->tooltips = gtk_tooltips_new(); | |
4106 | |
4421 | 4107 /* Setup the foreground and background colors */ |
4108 gaim_gtkconv_update_font_colors(conv); | |
4109 | |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
4110 /* Setup the font face */ |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
4111 gaim_gtkconv_update_font_face(conv); |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
4112 |
7879 | 4113 if (conv_type == GAIM_CONV_IM) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4114 gtkconv->u.im = g_malloc0(sizeof(GaimGtkImPane)); |
4359 | 4115 gtkconv->u.im->a_virgin = TRUE; |
4116 | |
4117 pane = setup_im_pane(conv); | |
4118 } | |
7879 | 4119 else if (conv_type == GAIM_CONV_CHAT) { |
4120 gtkconv->u.chat = g_malloc0(sizeof(GaimGtkChatPane)); | |
4121 | |
4122 pane = setup_chat_pane(conv); | |
4123 } | |
4359 | 4124 |
4125 if (pane == NULL) { | |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4126 if (conv_type == GAIM_CONV_CHAT) g_free(gtkconv->u.chat); |
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4127 else if (conv_type == GAIM_CONV_IM) g_free(gtkconv->u.im); |
4359 | 4128 |
4129 g_free(gtkconv); | |
4130 conv->ui_data = NULL; | |
4131 | |
4132 return; | |
4133 } | |
4134 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4135 /* Setup drag-and-drop */ |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4136 gtk_drag_dest_set(pane, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4137 GTK_DEST_DEFAULT_MOTION | |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4138 GTK_DEST_DEFAULT_DROP, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4139 te, sizeof(te) / sizeof(GtkTargetEntry), |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4140 GDK_ACTION_COPY); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4141 gtk_drag_dest_set(gtkconv->imhtml, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4142 GTK_DEST_DEFAULT_MOTION | |
4702 | 4143 GTK_DEST_DEFAULT_DROP, |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4144 te, sizeof(te) / sizeof(GtkTargetEntry), |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4145 GDK_ACTION_DEFAULT | GDK_ACTION_COPY | GDK_ACTION_MOVE); |
7695 | 4146 gtk_drag_dest_set(gtkconv->entry, |
4147 GTK_DEST_DEFAULT_MOTION | | |
4148 GTK_DEST_DEFAULT_DROP, | |
4149 te, sizeof(te) / sizeof(GtkTargetEntry), | |
4150 GDK_ACTION_COPY); | |
4151 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4152 g_signal_connect(G_OBJECT(pane), "drag_data_received", |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4153 G_CALLBACK(conv_dnd_recv), conv); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4154 g_signal_connect(G_OBJECT(gtkconv->imhtml), "drag_data_received", |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4155 G_CALLBACK(conv_dnd_recv), conv); |
7695 | 4156 #if 0 |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4157 g_signal_connect(G_OBJECT(gtkconv->entry), "drag_data_received", |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4158 G_CALLBACK(conv_dnd_recv), conv); |
7695 | 4159 #endif |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4160 |
4359 | 4161 /* Setup the container for the tab. */ |
4162 gtkconv->tab_cont = tab_cont = gtk_vbox_new(FALSE, 5); | |
4163 gtk_container_set_border_width(GTK_CONTAINER(tab_cont), 5); | |
4164 gtk_container_add(GTK_CONTAINER(tab_cont), pane); | |
4165 gtk_widget_show(pane); | |
4166 | |
4167 new_ui = TRUE; | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
4168 |
4359 | 4169 gtkconv->make_sound = TRUE; |
5902
6889b89cab90
[gaim-migrate @ 6334]
Christian Hammond <chipx86@chipx86.com>
parents:
5901
diff
changeset
|
4170 |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4171 gtkconv->show_formatting_toolbar = gaim_prefs_get_bool( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4172 "/gaim/gtk/conversations/show_formatting_toolbar"); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4173 |
5902
6889b89cab90
[gaim-migrate @ 6334]
Christian Hammond <chipx86@chipx86.com>
parents:
5901
diff
changeset
|
4174 g_signal_connect_swapped(G_OBJECT(pane), "focus", |
7143 | 4175 G_CALLBACK(gtk_widget_grab_focus), |
4176 gtkconv->entry); | |
4359 | 4177 } |
4178 | |
4179 gtkconv->tabby = tabby = gtk_hbox_new(FALSE, 5); | |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4180 gtkconv->menu_tabby = menu_tabby = gtk_hbox_new(FALSE, 5); |
4359 | 4181 |
4182 /* Close button. */ | |
4183 gtkconv->close = gtk_button_new(); | |
4184 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
|
4185 gtk_button_set_relief(GTK_BUTTON(gtkconv->close), GTK_RELIEF_NONE); |
4359 | 4186 gtk_container_add(GTK_CONTAINER(gtkconv->close), |
4445 | 4187 gtk_image_new_from_stock(GTK_STOCK_CLOSE, |
4188 GTK_ICON_SIZE_MENU)); | |
4359 | 4189 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->close, |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4190 _("Close conversation"), NULL); |
4359 | 4191 |
4192 g_signal_connect(G_OBJECT(gtkconv->close), "clicked", | |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4193 G_CALLBACK(close_conv_cb), conv); |
4359 | 4194 |
7446
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4195 /* |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4196 * 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
|
4197 * border bug. I love you guys! -- ChipX86 |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4198 */ |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4199 g_signal_connect(G_OBJECT(gtkconv->close), "state_changed", |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4200 G_CALLBACK(tab_close_button_state_changed_cb), NULL); |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4201 |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4202 /* Status icon. */ |
6440 | 4203 gtkconv->icon = gtk_image_new(); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4204 gtkconv->menu_icon = gtk_image_new(); |
6440 | 4205 update_tab_icon(conv); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4206 |
4359 | 4207 /* Tab label. */ |
4208 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
|
4209 gtkconv->menu_label = gtk_label_new(gaim_conversation_get_title(conv)); |
4359 | 4210 #if 0 |
4211 gtk_misc_set_alignment(GTK_MISC(gtkconv->tab_label), 0.00, 0.5); | |
4212 gtk_misc_set_padding(GTK_MISC(gtkconv->tab_label), 4, 0); | |
4213 #endif | |
4214 | |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
4215 |
4359 | 4216 /* Pack it all together. */ |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4217 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
|
4218 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
|
4219 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
|
4220 gtk_widget_show_all(gtkconv->icon); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4221 gtk_widget_show_all(gtkconv->menu_icon); |
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4222 } |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4223 |
4359 | 4224 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
|
4225 gtk_box_pack_start(GTK_BOX(menu_tabby), gtkconv->menu_label, TRUE, TRUE, 0); |
4445 | 4226 gtk_widget_show(gtkconv->tab_label); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4227 gtk_widget_show(gtkconv->menu_label); |
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4228 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
|
4229 |
4445 | 4230 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
|
4231 if (gaim_prefs_get_bool("/gaim/gtk/conversations/close_on_tabs")) |
4445 | 4232 gtk_widget_show_all(gtkconv->close); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4233 |
4445 | 4234 gtk_widget_show(tabby); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4235 gtk_widget_show(menu_tabby); |
4359 | 4236 |
7143 | 4237 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
4238 gaim_gtkconv_update_buddy_icon(conv); | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4239 |
4359 | 4240 /* Add this pane to the conversations notebook. */ |
4241 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
|
4242 gtk_notebook_set_menu_label(GTK_NOTEBOOK(gtkwin->notebook), tab_cont, menu_tabby); |
4359 | 4243 |
4244 gtk_widget_show(tab_cont); | |
4245 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4246 if (gaim_conv_window_get_conversation_count(win) == 1) { |
4818 | 4247 /* Er, bug in notebooks? Switch to the page manually. */ |
4359 | 4248 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), 0); |
4851 | 4249 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4250 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4251 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4252 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4253 else |
4818 | 4254 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), TRUE); |
4359 | 4255 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4256 focus_conv = g_list_nth_data(gaim_conv_window_get_conversations(win), |
5204 | 4257 gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook))); |
4258 focus_gtkconv = GAIM_GTK_CONVERSATION(focus_conv); | |
4259 gtk_widget_grab_focus(focus_gtkconv->entry); | |
4359 | 4260 |
4261 if (!new_ui) | |
4262 g_object_unref(gtkconv->tab_cont); | |
4263 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4264 if (gaim_conv_window_get_conversation_count(win) == 1) |
4685 | 4265 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); |
4359 | 4266 } |
4267 | |
4268 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4269 gaim_gtk_remove_conversation(GaimConvWindow *win, GaimConversation *conv) |
4359 | 4270 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4271 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4272 GaimGtkConversation *gtkconv; |
4359 | 4273 unsigned int index; |
4818 | 4274 GaimConversationType conv_type; |
4275 | |
4276 conv_type = gaim_conversation_get_type(conv); | |
4359 | 4277 index = gaim_conversation_get_index(conv); |
4278 | |
4279 gtkwin = GAIM_GTK_WINDOW(win); | |
4280 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4281 | |
4282 g_object_ref(gtkconv->tab_cont); | |
4283 gtk_object_sink(GTK_OBJECT(gtkconv->tab_cont)); | |
4284 | |
4285 gtk_notebook_remove_page(GTK_NOTEBOOK(gtkwin->notebook), index); | |
4286 | |
4818 | 4287 /* go back to tabless if need be */ |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4288 if (gaim_conv_window_get_conversation_count(win) <= 2) { |
4818 | 4289 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4290 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); |
4818 | 4291 } |
4292 | |
4293 | |
4359 | 4294 /* If this window is setup with an inactive gc, regenerate the menu. */ |
4818 | 4295 if (conv_type == GAIM_CONV_IM && |
4359 | 4296 gaim_conversation_get_gc(conv) == NULL) { |
4297 | |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
4298 generate_send_as_items(win, conv); |
4359 | 4299 } |
4300 } | |
4301 | |
4302 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4303 gaim_gtk_move_conversation(GaimConvWindow *win, GaimConversation *conv, |
4359 | 4304 unsigned int new_index) |
4305 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4306 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4307 GaimGtkConversation *gtkconv; |
4359 | 4308 |
4309 gtkwin = GAIM_GTK_WINDOW(win); | |
4310 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4311 | |
4415
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4312 if (new_index > gaim_conversation_get_index(conv)) |
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4313 new_index--; |
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4314 |
4359 | 4315 gtk_notebook_reorder_child(GTK_NOTEBOOK(gtkwin->notebook), |
4316 gtkconv->tab_cont, new_index); | |
4317 } | |
4318 | |
4319 static int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4320 gaim_gtk_get_active_index(const GaimConvWindow *win) |
4359 | 4321 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4322 GaimGtkWindow *gtkwin; |
5680
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4323 int index; |
4359 | 4324 |
4325 gtkwin = GAIM_GTK_WINDOW(win); | |
4326 | |
5680
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4327 index = gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook)); |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4328 |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4329 /* |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4330 * A fix, because the first conversation may be active, but not |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4331 * appear in the notebook just yet. -- ChipX86 |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4332 */ |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4333 return (index == -1 ? 0 : index); |
4359 | 4334 } |
4335 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4336 static GaimConvWindowUiOps window_ui_ops = |
4359 | 4337 { |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
4338 gaim_gtk_conversations_get_conv_ui_ops, |
4359 | 4339 gaim_gtk_new_window, |
4340 gaim_gtk_destroy_window, | |
4341 gaim_gtk_show, | |
4342 gaim_gtk_hide, | |
4343 gaim_gtk_raise, | |
4344 gaim_gtk_flash, | |
4345 gaim_gtk_switch_conversation, | |
4346 gaim_gtk_add_conversation, | |
4347 gaim_gtk_remove_conversation, | |
4348 gaim_gtk_move_conversation, | |
4349 gaim_gtk_get_active_index | |
4350 }; | |
4351 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4352 GaimConvWindowUiOps * |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
4353 gaim_gtk_conversations_get_win_ui_ops(void) |
4359 | 4354 { |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4355 return &window_ui_ops; |
4359 | 4356 } |
4357 | |
4358 /************************************************************************** | |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4359 * Conversation UI operations |
4359 | 4360 **************************************************************************/ |
4361 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4362 gaim_gtkconv_destroy(GaimConversation *conv) |
4359 | 4363 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4364 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); |
4359 | 4365 |
4366 if (gtkconv->dialogs.fg_color != NULL) | |
4367 gtk_widget_destroy(gtkconv->dialogs.fg_color); | |
4368 | |
4369 if (gtkconv->dialogs.bg_color != NULL) | |
4370 gtk_widget_destroy(gtkconv->dialogs.bg_color); | |
4371 | |
4372 if (gtkconv->dialogs.font != NULL) | |
4373 gtk_widget_destroy(gtkconv->dialogs.font); | |
4374 | |
5959 | 4375 if (gtkconv->dialogs.image != NULL) |
4376 gtk_widget_destroy(gtkconv->dialogs.image); | |
4377 | |
4359 | 4378 if (gtkconv->dialogs.smiley != NULL) |
4379 gtk_widget_destroy(gtkconv->dialogs.smiley); | |
4380 | |
4381 if (gtkconv->dialogs.link != NULL) | |
4382 gtk_widget_destroy(gtkconv->dialogs.link); | |
4383 | |
4384 if (gtkconv->dialogs.log != NULL) | |
4385 gtk_widget_destroy(gtkconv->dialogs.log); | |
4386 | |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4387 gtk_widget_destroy(gtkconv->tab_cont); |
4892 | 4388 g_object_unref(gtkconv->tab_cont); |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4389 |
4359 | 4390 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
4755 | 4391 if (gtkconv->u.im->icon_timer != 0) |
4392 g_source_remove(gtkconv->u.im->icon_timer); | |
4393 | |
4359 | 4394 if (gtkconv->u.im->save_icon != NULL) |
4395 gtk_widget_destroy(gtkconv->u.im->save_icon); | |
4396 | |
4397 if (gtkconv->u.im->anim != NULL) | |
4793 | 4398 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); |
4359 | 4399 |
4400 g_free(gtkconv->u.im); | |
4401 } | |
4402 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
4403 g_free(gtkconv->u.chat); | |
4404 } | |
4405 | |
4633 | 4406 gtk_object_sink(GTK_OBJECT(gtkconv->tooltips)); |
4407 | |
4359 | 4408 g_free(gtkconv); |
4409 } | |
4410 | |
4411 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4412 gaim_gtkconv_write_im(GaimConversation *conv, const char *who, |
6982 | 4413 const char *message, GaimMessageFlags flags, |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4414 time_t mtime) |
4359 | 4415 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4416 GaimGtkConversation *gtkconv; |
4359 | 4417 |
4418 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4419 | |
6621 | 4420 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4421 gaim_prefs_get_bool("/gaim/gtk/conversations/im/raise_on_events")) { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4422 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4423 gaim_conv_window_raise(gaim_conversation_get_window(conv)); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4424 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4425 |
4382
76223649765b
[gaim-migrate @ 4648]
Christian Hammond <chipx86@chipx86.com>
parents:
4378
diff
changeset
|
4426 /* Play a sound, if specified in prefs. */ |
4359 | 4427 if (gtkconv->make_sound) { |
6621 | 4428 if (flags & GAIM_MESSAGE_RECV) { |
4359 | 4429 if (gtkconv->u.im->a_virgin && |
5820 | 4430 gaim_prefs_get_bool("/gaim/gtk/sound/enabled/first_im_recv")) { |
4359 | 4431 |
4561 | 4432 gaim_sound_play_event(GAIM_SOUND_FIRST_RECEIVE); |
4359 | 4433 } |
4434 else | |
4561 | 4435 gaim_sound_play_event(GAIM_SOUND_RECEIVE); |
4359 | 4436 } |
4437 else { | |
4561 | 4438 gaim_sound_play_event(GAIM_SOUND_SEND); |
4359 | 4439 } |
4440 } | |
4441 | |
4442 gtkconv->u.im->a_virgin = FALSE; | |
4443 | |
6982 | 4444 gaim_conversation_write(conv, who, message, flags, mtime); |
4359 | 4445 } |
4446 | |
4447 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4448 gaim_gtkconv_write_chat(GaimConversation *conv, const char *who, |
6621 | 4449 const char *message, GaimMessageFlags flags, time_t mtime) |
4359 | 4450 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4451 GaimGtkConversation *gtkconv; |
4359 | 4452 |
4453 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4454 | |
4382
76223649765b
[gaim-migrate @ 4648]
Christian Hammond <chipx86@chipx86.com>
parents:
4378
diff
changeset
|
4455 /* Play a sound, if specified in prefs. */ |
4359 | 4456 if (gtkconv->make_sound) { |
6621 | 4457 if (!(flags & GAIM_MESSAGE_WHISPER) && (flags & GAIM_MESSAGE_SEND)) |
4561 | 4458 gaim_sound_play_event(GAIM_SOUND_CHAT_YOU_SAY); |
6621 | 4459 else if (flags & GAIM_MESSAGE_RECV) { |
4460 if ((flags & GAIM_MESSAGE_NICK) && | |
6102 | 4461 gaim_prefs_get_bool("/gaim/gtk/sound/enabled/nick_said")) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4462 |
4561 | 4463 gaim_sound_play_event(GAIM_SOUND_CHAT_NICK); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4464 } |
4359 | 4465 else |
4561 | 4466 gaim_sound_play_event(GAIM_SOUND_CHAT_SAY); |
4359 | 4467 } |
4468 } | |
4469 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4470 if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/color_nicks")) |
6621 | 4471 flags |= GAIM_MESSAGE_COLORIZE; |
4359 | 4472 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4473 /* Raise the window, if specified in prefs. */ |
6621 | 4474 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4475 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4476 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4477 gaim_conv_window_raise(gaim_conversation_get_window(conv)); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4478 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4479 |
6982 | 4480 gaim_conversation_write(conv, who, message, flags, mtime); |
4359 | 4481 } |
4482 | |
4483 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4484 gaim_gtkconv_write_conv(GaimConversation *conv, const char *who, |
6982 | 4485 const char *message, GaimMessageFlags flags, |
4359 | 4486 time_t mtime) |
4487 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4488 GaimGtkConversation *gtkconv; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4489 GaimConvWindow *win; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
4490 GaimConnection *gc; |
4359 | 4491 int gtk_font_options = 0; |
6982 | 4492 GSList *images = NULL; |
7440 | 4493 char buf[BUF_LONG]; |
4359 | 4494 char buf2[BUF_LONG]; |
4495 char mdate[64]; | |
4496 char color[10]; | |
4497 char *str; | |
4498 char *with_font_tag; | |
4896 | 4499 char *sml_attrib = NULL; |
6982 | 4500 size_t length = strlen(message) + 1; |
4895 | 4501 |
4359 | 4502 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4503 gc = gaim_conversation_get_gc(conv); | |
4504 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4505 win = gaim_conversation_get_window(conv); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4506 |
6621 | 4507 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
7431 | 4508 ((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT && |
4509 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) || | |
4510 (gaim_conversation_get_type(conv) == GAIM_CONV_IM && | |
4511 (gaim_prefs_get_bool("/gaim/gtk/conversations/im/raise_on_events") || | |
4512 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
|
4513 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4514 gaim_conv_window_show(win); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4515 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4516 |
7078 | 4517 if (flags & GAIM_MESSAGE_IMAGES) |
4518 gaim_gtk_find_images(message, &images); | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4519 |
5133 | 4520 if(time(NULL) > mtime + 20*60) /* show date if older than 20 minutes */ |
4521 strftime(mdate, sizeof(mdate), "%Y-%m-%d %H:%M:%S", localtime(&mtime)); | |
4522 else | |
4523 strftime(mdate, sizeof(mdate), "%H:%M:%S", localtime(&mtime)); | |
4359 | 4524 |
4896 | 4525 if(gc) |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4526 sml_attrib = g_strdup_printf("sml=\"%s\"", gc->prpl->info->name); |
7440 | 4527 |
4359 | 4528 gtk_font_options ^= GTK_IMHTML_NO_COMMENTS; |
4529 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4530 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_colors")) |
4359 | 4531 gtk_font_options ^= GTK_IMHTML_NO_COLOURS; |
4532 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4533 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_fonts")) |
4359 | 4534 gtk_font_options ^= GTK_IMHTML_NO_FONTS; |
4535 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4536 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_font_sizes")) |
4359 | 4537 gtk_font_options ^= GTK_IMHTML_NO_SIZES; |
4538 | |
7956 | 4539 /* this is gonna crash one day, I can feel it. */ |
4540 if (GAIM_PLUGIN_PROTOCOL_INFO(gaim_find_prpl(gaim_account_get_protocol_id(conv->account)))->options & | |
7431 | 4541 OPT_PROTO_USE_POINTSIZE) { |
5367 | 4542 gtk_font_options ^= GTK_IMHTML_USE_POINTSIZE; |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4543 } |
4359 | 4544 |
6621 | 4545 if (flags & GAIM_MESSAGE_SYSTEM) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4546 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) |
5329 | 4547 g_snprintf(buf, BUF_LONG, "(%s) <B>%s</B>", |
7431 | 4548 mdate, message); |
4359 | 4549 else |
4550 g_snprintf(buf, BUF_LONG, "<B>%s</B>", message); | |
7440 | 4551 |
4359 | 4552 g_snprintf(buf2, sizeof(buf2), |
7850 | 4553 "<FONT %s><!--(%s) --><B>%s</B></FONT><BR>", |
4554 sml_attrib, mdate, message); | |
7440 | 4555 |
6982 | 4556 gtk_imhtml_append_text_with_images(GTK_IMHTML(gtkconv->imhtml), buf2, 0, images); |
7440 | 4557 |
7583 | 4558 /* Add the message to a conversations scrollback buffer */ |
4559 conv->history = g_string_append(conv->history, buf); | |
4560 conv->history = g_string_append(conv->history, "<BR>\n"); | |
7440 | 4561 |
7431 | 4562 } else if (flags & GAIM_MESSAGE_NO_LOG) { |
4359 | 4563 g_snprintf(buf, BUF_LONG, |
7850 | 4564 "<B><FONT %s COLOR=\"#777777\">%s</FONT></B><BR>", |
4565 sml_attrib, message); | |
7440 | 4566 |
6982 | 4567 gtk_imhtml_append_text_with_images(GTK_IMHTML(gtkconv->imhtml), buf, 0, images); |
4359 | 4568 } |
4569 else { | |
4895 | 4570 char *new_message = g_memdup(message, length); |
7440 | 4571 |
6621 | 4572 if (flags & GAIM_MESSAGE_WHISPER) { |
4359 | 4573 str = g_malloc(1024); |
7440 | 4574 |
4359 | 4575 /* If we're whispering, it's not an autoresponse. */ |
7564 | 4576 if (gaim_message_meify(new_message, length)) { |
4359 | 4577 g_snprintf(str, 1024, "***%s", who); |
4578 strcpy(color, "#6C2585"); | |
4579 } | |
4580 else { | |
4581 g_snprintf(str, 1024, "*%s*:", who); | |
4582 strcpy(color, "#00FF00"); | |
4583 } | |
7440 | 4584 } |
4359 | 4585 else { |
7564 | 4586 if (gaim_message_meify(new_message, length)) { |
4359 | 4587 str = g_malloc(1024); |
7440 | 4588 |
6621 | 4589 if (flags & GAIM_MESSAGE_AUTO_RESP) |
4359 | 4590 g_snprintf(str, 1024, "%s ***%s", AUTO_RESPONSE, who); |
4591 else | |
4592 g_snprintf(str, 1024, "***%s", who); | |
7440 | 4593 |
6621 | 4594 if (flags & GAIM_MESSAGE_NICK) |
4359 | 4595 strcpy(color, "#AF7F00"); |
4596 else | |
4597 strcpy(color, "#062585"); | |
4598 } | |
4599 else { | |
4600 str = g_malloc(1024); | |
6621 | 4601 if (flags & GAIM_MESSAGE_AUTO_RESP) |
4359 | 4602 g_snprintf(str, 1024, "%s %s", who, AUTO_RESPONSE); |
4603 else | |
4604 g_snprintf(str, 1024, "%s:", who); | |
6621 | 4605 if (flags & GAIM_MESSAGE_NICK) |
4359 | 4606 strcpy(color, "#AF7F00"); |
6621 | 4607 else if (flags & GAIM_MESSAGE_RECV) { |
4608 if (flags & GAIM_MESSAGE_COLORIZE) { | |
4359 | 4609 const char *u; |
4610 int m = 0; | |
7440 | 4611 |
4359 | 4612 for (u = who; *u != '\0'; u++) |
4613 m += *u; | |
7440 | 4614 |
4359 | 4615 m = m % NUM_NICK_COLORS; |
7440 | 4616 |
4359 | 4617 strcpy(color, nick_colors[m]); |
4618 } | |
4619 else | |
7854 | 4620 strcpy(color, RECV_COLOR); |
4359 | 4621 } |
6621 | 4622 else if (flags & GAIM_MESSAGE_SEND) |
7854 | 4623 strcpy(color, SEND_COLOR); |
4359 | 4624 } |
4625 } | |
7440 | 4626 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4627 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) |
4359 | 4628 g_snprintf(buf, BUF_LONG, |
7431 | 4629 "<FONT COLOR=\"%s\" %s>(%s) " |
4630 "<B>%s</B></FONT> ", color, | |
4631 sml_attrib ? sml_attrib : "", mdate, str); | |
4359 | 4632 else |
4633 g_snprintf(buf, BUF_LONG, | |
7431 | 4634 "<FONT COLOR=\"%s\" %s><B>%s</B></FONT> ", color, |
4635 sml_attrib ? sml_attrib : "", str); | |
7440 | 4636 |
4359 | 4637 g_snprintf(buf2, BUF_LONG, |
7431 | 4638 "<FONT COLOR=\"%s\" %s><!--(%s) -->" |
4639 "<B>%s</B></FONT> ", | |
4640 color, sml_attrib ? sml_attrib : "", mdate, str); | |
7440 | 4641 |
4359 | 4642 g_free(str); |
4643 | |
6982 | 4644 gtk_imhtml_append_text_with_images(GTK_IMHTML(gtkconv->imhtml), buf2, 0, images); |
4359 | 4645 |
4895 | 4646 if(gc){ |
4896 | 4647 char *pre = g_strdup_printf("<font %s>", sml_attrib ? sml_attrib : ""); |
4895 | 4648 char *post = "</font>"; |
4649 int pre_len = strlen(pre); | |
4650 int post_len = strlen(post); | |
7440 | 4651 |
4895 | 4652 with_font_tag = g_malloc(length + pre_len + post_len + 1); |
7440 | 4653 |
4895 | 4654 strcpy(with_font_tag, pre); |
4655 memcpy(with_font_tag + pre_len, new_message, length); | |
4656 strcpy(with_font_tag + pre_len + length, post); | |
7440 | 4657 |
4895 | 4658 length += pre_len + post_len; |
4659 g_free(pre); | |
4660 } | |
4608 | 4661 else |
4895 | 4662 with_font_tag = g_memdup(new_message, length); |
7440 | 4663 |
7589 | 4664 gtk_imhtml_append_text_with_images(GTK_IMHTML(gtkconv->imhtml), |
7431 | 4665 with_font_tag, gtk_font_options, images); |
7440 | 4666 |
6982 | 4667 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", 0); |
7440 | 4668 |
7431 | 4669 /*conv->history = g_string_append(conv->history, t1); |
4670 conv->history = g_string_append(conv->history, t2); | |
4671 conv->history = g_string_append(conv->history, "\n"); | |
7440 | 4672 |
7431 | 4673 g_free(t1); |
4674 g_free(t2); */ | |
7440 | 4675 |
4676 g_free(with_font_tag); | |
7447 | 4677 g_free(new_message); |
7440 | 4678 } |
4679 | |
6062 | 4680 |
5012 | 4681 if(sml_attrib) |
4682 g_free(sml_attrib); | |
6982 | 4683 |
4684 if (images) { | |
7078 | 4685 GSList *tmp; |
4686 | |
4687 for (tmp = images; tmp; tmp = tmp->next) { | |
4688 GdkPixbuf *pixbuf = tmp->data; | |
4689 if(pixbuf) | |
4690 g_object_unref(pixbuf); | |
6982 | 4691 } |
7078 | 4692 |
6982 | 4693 g_slist_free(images); |
4694 } | |
4359 | 4695 } |
4696 | |
4697 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4698 gaim_gtkconv_chat_add_user(GaimConversation *conv, const char *user) |
4359 | 4699 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4700 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4701 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4702 GaimGtkChatPane *gtkchat; |
4359 | 4703 char tmp[BUF_LONG]; |
4704 int num_users; | |
4705 int pos; | |
4706 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4707 chat = GAIM_CONV_CHAT(conv); |
4359 | 4708 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4709 gtkchat = gtkconv->u.chat; | |
4710 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4711 num_users = g_list_length(gaim_conv_chat_get_users(chat)); |
4359 | 4712 |
4713 g_snprintf(tmp, sizeof(tmp), | |
4714 ngettext("%d person in room", "%d people in room", | |
4715 num_users), | |
4716 num_users); | |
4717 | |
4718 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); | |
4719 | |
4720 if (gtkconv->make_sound) | |
4561 | 4721 gaim_sound_play_event(GAIM_SOUND_CHAT_JOIN); |
4359 | 4722 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4723 pos = g_list_index(gaim_conv_chat_get_users(chat), user); |
4359 | 4724 |
4725 add_chat_buddy_common(conv, user, pos); | |
4726 } | |
4727 | |
4728 static void | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4729 gaim_gtkconv_chat_add_users(GaimConversation *conv, GList *users) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4730 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4731 GaimConvChat *chat; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4732 GaimGtkConversation *gtkconv; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4733 GaimGtkChatPane *gtkchat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4734 GList *l; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4735 char tmp[BUF_LONG]; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4736 int num_users; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4737 int pos; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4738 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4739 chat = GAIM_CONV_CHAT(conv); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4740 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4741 gtkchat = gtkconv->u.chat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4742 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4743 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
|
4744 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4745 g_snprintf(tmp, sizeof(tmp), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4746 ngettext("%d person in room", "%d people in room", |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4747 num_users), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4748 num_users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4749 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4750 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4751 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4752 for (l = users; l != NULL; l = l->next) { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4753 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
|
4754 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4755 add_chat_buddy_common(conv, (char *)l->data, pos); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4756 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4757 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4758 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4759 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4760 gaim_gtkconv_chat_rename_user(GaimConversation *conv, const char *old_name, |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4761 const char *new_name) |
4359 | 4762 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4763 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4764 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4765 GaimGtkChatPane *gtkchat; |
4359 | 4766 GtkTreeIter iter; |
4767 GtkTreeModel *model; | |
4768 GList *names; | |
4769 int pos; | |
4770 int f = 1; | |
4771 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4772 chat = GAIM_CONV_CHAT(conv); |
4359 | 4773 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4774 gtkchat = gtkconv->u.chat; | |
4775 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4776 for (names = gaim_conv_chat_get_users(chat); |
4359 | 4777 names != NULL; |
4778 names = names->next) { | |
4779 | |
4780 char *u = (char *)names->data; | |
4781 | |
4793 | 4782 if (!gaim_utf8_strcasecmp(u, old_name)) { |
4359 | 4783 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
4784 | |
4785 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
4786 break; | |
4787 | |
4788 while (f != 0) { | |
4789 char *val; | |
4790 | |
4791 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &val, -1); | |
4792 | |
4793 | 4793 if (!gaim_utf8_strcasecmp(old_name, val)) { |
4359 | 4794 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
4640 | 4795 break; |
4796 } | |
4359 | 4797 |
4798 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
4799 | |
4800 g_free(val); | |
4801 } | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
4802 |
4359 | 4803 break; |
4804 } | |
4805 } | |
4806 | |
4807 if (!names) | |
4808 return; | |
4809 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4810 pos = g_list_index(gaim_conv_chat_get_users(chat), new_name); |
4359 | 4811 |
4812 add_chat_buddy_common(conv, new_name, pos); | |
4813 } | |
4814 | |
4815 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4816 gaim_gtkconv_chat_remove_user(GaimConversation *conv, const char *user) |
4359 | 4817 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4818 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4819 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4820 GaimGtkChatPane *gtkchat; |
4359 | 4821 GtkTreeIter iter; |
4822 GtkTreeModel *model; | |
4823 GList *names; | |
4824 char tmp[BUF_LONG]; | |
4825 int num_users; | |
4826 int f = 1; | |
4827 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4828 chat = GAIM_CONV_CHAT(conv); |
4359 | 4829 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4830 gtkchat = gtkconv->u.chat; | |
4831 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4832 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
|
4833 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4834 for (names = gaim_conv_chat_get_users(chat); |
4359 | 4835 names != NULL; |
4836 names = names->next) { | |
4837 | |
4838 char *u = (char *)names->data; | |
4839 | |
4793 | 4840 if (!gaim_utf8_strcasecmp(u, user)) { |
4359 | 4841 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
4842 | |
4843 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
4844 break; | |
4845 | |
4846 while (f != 0) { | |
4847 char *val; | |
4848 | |
4849 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &val, -1); | |
4850 | |
4793 | 4851 if (!gaim_utf8_strcasecmp(user, val)) |
4359 | 4852 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
4853 | |
4854 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
4855 | |
4856 g_free(val); | |
4857 } | |
4858 | |
4859 break; | |
4860 } | |
4861 } | |
4862 | |
4863 if (names == NULL) | |
4864 return; | |
4865 | |
4866 g_snprintf(tmp, sizeof(tmp), | |
4867 ngettext("%d person in room", "%d people in room", | |
4868 num_users), num_users); | |
4869 | |
4870 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); | |
4871 | |
4872 if (gtkconv->make_sound) | |
4561 | 4873 gaim_sound_play_event(GAIM_SOUND_CHAT_LEAVE); |
4359 | 4874 } |
4875 | |
4876 static void | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4877 gaim_gtkconv_chat_remove_users(GaimConversation *conv, GList *users) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4878 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4879 GaimConvChat *chat; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4880 GaimGtkConversation *gtkconv; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4881 GaimGtkChatPane *gtkchat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4882 GtkTreeIter iter; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4883 GtkTreeModel *model; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4884 GList *names = NULL; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4885 GList *l; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4886 char tmp[BUF_LONG]; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4887 int num_users; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4888 int f = 1; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4889 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4890 chat = GAIM_CONV_CHAT(conv); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4891 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4892 gtkchat = gtkconv->u.chat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4893 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4894 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
|
4895 g_list_length(users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4896 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4897 for (l = users; l != NULL; l = l->next) { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4898 for (names = gaim_conv_chat_get_users(chat); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4899 names != NULL; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4900 names = names->next) { |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4901 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4902 char *u = (char *)names->data; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4903 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4904 if (!gaim_utf8_strcasecmp(u, (char *)l->data)) { |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4905 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4906 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4907 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4908 &iter)) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4909 break; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4910 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4911 while (f != 0) { |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4912 char *val; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4913 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4914 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4915 1, &val, -1); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4916 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4917 if (!gaim_utf8_strcasecmp((char *)l->data, val)) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4918 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4919 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4920 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4921 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4922 g_free(val); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4923 } |
7431 | 4924 |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4925 break; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4926 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4927 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4928 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4929 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4930 if (names == NULL) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4931 return; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4932 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4933 g_snprintf(tmp, sizeof(tmp), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4934 ngettext("%d person in room", "%d people in room", |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4935 num_users), num_users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4936 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4937 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4938 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4939 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4940 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4941 gaim_gtkconv_set_title(GaimConversation *conv, const char *title) |
4359 | 4942 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4943 GaimGtkConversation *gtkconv; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4944 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4945 GaimGtkWindow *gtkwin; |
4681 | 4946 |
4947 win = gaim_conversation_get_window(conv); | |
4948 gtkwin = GAIM_GTK_WINDOW(win); | |
4359 | 4949 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4950 | |
4951 gtk_label_set_text(GTK_LABEL(gtkconv->tab_label), title); | |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4952 gtk_label_set_text(GTK_LABEL(gtkconv->menu_label), title); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4953 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4954 if(conv == gaim_conv_window_get_active_conversation(win)) |
4681 | 4955 gtk_window_set_title(GTK_WINDOW(gtkwin->window), title); |
4359 | 4956 } |
4957 | |
4958 static void | |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4959 update_tab_icon(GaimConversation *conv) |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4960 { |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4961 GaimGtkConversation *gtkconv; |
7146 | 4962 GaimConvWindow *win = gaim_conversation_get_window(conv); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4963 GaimAccount *account; |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4964 const char *name; |
7008 | 4965 GdkPixbuf *status = NULL; |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4966 |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4967 gtkconv = GAIM_GTK_CONVERSATION(conv); |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4968 name = gaim_conversation_get_name(conv); |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4969 account = gaim_conversation_get_account(conv); |
6440 | 4970 |
7143 | 4971 status = get_tab_icon(conv); |
7008 | 4972 |
4973 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->icon), status); | |
4974 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->menu_icon), status); | |
4975 | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4976 if (gaim_conv_window_get_active_conversation(win) == conv && gtkconv->u.im->anim == NULL) |
7146 | 4977 gtk_window_set_icon(GTK_WINDOW(GAIM_GTK_WINDOW(win)->window), status); |
4978 | |
7008 | 4979 if(status) |
4980 g_object_unref(status); | |
7146 | 4981 |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4982 } |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4983 |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4984 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4985 gaim_gtkconv_updated(GaimConversation *conv, GaimConvUpdateType type) |
4359 | 4986 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4987 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4988 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4989 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4990 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4991 GaimConvChat *chat; |
4359 | 4992 |
4993 win = gaim_conversation_get_window(conv); | |
4736 | 4994 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4995 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4996 | |
4491 | 4997 if (type == GAIM_CONV_UPDATE_ACCOUNT) { |
4359 | 4998 gaim_conversation_autoset_title(conv); |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
4999 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5000 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5001 gaim_gtkconv_update_buddy_icon(conv); |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5002 |
4359 | 5003 gaim_gtkconv_update_buttons_by_protocol(conv); |
5004 | |
4685 | 5005 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); |
4359 | 5006 |
5007 smiley_themeize(gtkconv->imhtml); | |
6394 | 5008 |
6395 | 5009 update_tab_icon(conv); |
4359 | 5010 } |
5011 else if (type == GAIM_CONV_UPDATE_TYPING || | |
5012 type == GAIM_CONV_UPDATE_UNSEEN) { | |
5013 GtkStyle *style; | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5014 GaimConvIm *im = NULL; |
4359 | 5015 |
4736 | 5016 |
4359 | 5017 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5018 im = GAIM_CONV_IM(conv); |
4359 | 5019 |
5020 style = gtk_style_new(); | |
5021 | |
5022 if (!GTK_WIDGET_REALIZED(gtkconv->tab_label)) | |
5023 gtk_widget_realize(gtkconv->tab_label); | |
5024 | |
4757 | 5025 pango_font_description_free(style->font_desc); |
4635 | 5026 style->font_desc = pango_font_description_copy( |
5027 gtk_widget_get_style(gtkconv->tab_label)->font_desc); | |
4359 | 5028 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5029 if (im != NULL && gaim_conv_im_get_typing_state(im) == GAIM_TYPING) { |
4577 | 5030 style->fg[GTK_STATE_NORMAL].red = 0x4646; |
5031 style->fg[GTK_STATE_NORMAL].green = 0xA0A0; | |
5032 style->fg[GTK_STATE_NORMAL].blue = 0x4646; | |
5033 style->fg[GTK_STATE_ACTIVE] = style->fg[GTK_STATE_NORMAL]; | |
4359 | 5034 } |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5035 else if (im != NULL && gaim_conv_im_get_typing_state(im) == GAIM_TYPED) { |
4577 | 5036 style->fg[GTK_STATE_NORMAL].red = 0xD1D1; |
5037 style->fg[GTK_STATE_NORMAL].green = 0x9494; | |
5038 style->fg[GTK_STATE_NORMAL].blue = 0x0C0C; | |
5039 style->fg[GTK_STATE_ACTIVE] = style->fg[GTK_STATE_NORMAL]; | |
4359 | 5040 } |
5041 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_NICK) { | |
4577 | 5042 style->fg[GTK_STATE_ACTIVE].red = 0x3131; |
5043 style->fg[GTK_STATE_ACTIVE].green = 0x4E4E; | |
5044 style->fg[GTK_STATE_ACTIVE].blue = 0x6C6C; | |
4578 | 5045 style->fg[GTK_STATE_NORMAL] = style->fg[GTK_STATE_ACTIVE]; |
4359 | 5046 } |
6405
96de6d9eb422
[gaim-migrate @ 6910]
Christian Hammond <chipx86@chipx86.com>
parents:
6401
diff
changeset
|
5047 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_EVENT) { |
96de6d9eb422
[gaim-migrate @ 6910]
Christian Hammond <chipx86@chipx86.com>
parents:
6401
diff
changeset
|
5048 style->fg[GTK_STATE_ACTIVE].red = 0x8686;; |
96de6d9eb422
[gaim-migrate @ 6910]
Christian Hammond <chipx86@chipx86.com>
parents:
6401
diff
changeset
|
5049 style->fg[GTK_STATE_ACTIVE].green = 0x8282; |
96de6d9eb422
[gaim-migrate @ 6910]
Christian Hammond <chipx86@chipx86.com>
parents:
6401
diff
changeset
|
5050 style->fg[GTK_STATE_ACTIVE].blue = 0x7272; |
96de6d9eb422
[gaim-migrate @ 6910]
Christian Hammond <chipx86@chipx86.com>
parents:
6401
diff
changeset
|
5051 style->fg[GTK_STATE_NORMAL] = style->fg[GTK_STATE_ACTIVE]; |
96de6d9eb422
[gaim-migrate @ 6910]
Christian Hammond <chipx86@chipx86.com>
parents:
6401
diff
changeset
|
5052 } |
4359 | 5053 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_TEXT) { |
4577 | 5054 style->fg[GTK_STATE_ACTIVE].red = 0xDFDF; |
5055 style->fg[GTK_STATE_ACTIVE].green = 0x4242; | |
5056 style->fg[GTK_STATE_ACTIVE].blue = 0x1E1E; | |
4578 | 5057 style->fg[GTK_STATE_NORMAL] = style->fg[GTK_STATE_ACTIVE]; |
4359 | 5058 } |
5059 | |
5060 gtk_widget_set_style(gtkconv->tab_label, style); | |
4635 | 5061 g_object_unref(G_OBJECT(style)); |
4736 | 5062 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5063 if(conv == gaim_conv_window_get_active_conversation(win)) { |
4736 | 5064 update_typing_icon(conv); |
5065 } | |
5066 | |
4359 | 5067 } |
5068 else if (type == GAIM_CONV_UPDATE_TOPIC) { | |
7154 | 5069 const char *topic; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5070 chat = GAIM_CONV_CHAT(conv); |
4359 | 5071 gtkchat = gtkconv->u.chat; |
5072 | |
7154 | 5073 topic = gaim_conv_chat_get_topic(chat); |
5074 | |
5075 gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text),topic); | |
5076 gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->topic_text, | |
5077 topic, NULL); | |
4359 | 5078 } |
5079 else if (type == GAIM_CONV_ACCOUNT_ONLINE || | |
5080 type == GAIM_CONV_ACCOUNT_OFFLINE) { | |
5081 | |
7929 | 5082 gray_stuff_out(gaim_conv_window_get_active_conversation(win)); |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
5083 generate_send_as_items(win, NULL); |
6440 | 5084 if (gaim_prefs_get_bool("/gaim/gtk/conversations/icons_on_tabs")) |
5085 update_tab_icon(conv); | |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5086 } |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5087 else if (type == GAIM_CONV_UPDATE_AWAY) { |
6440 | 5088 if (gaim_prefs_get_bool("/gaim/gtk/conversations/icons_on_tabs")) |
5089 update_tab_icon(conv); | |
4359 | 5090 } |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5091 else if (type == GAIM_CONV_UPDATE_ADD || |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5092 type == GAIM_CONV_UPDATE_REMOVE) { |
4736 | 5093 |
7929 | 5094 gray_stuff_out(conv); |
4397
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
5095 } |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5096 else if (type == GAIM_CONV_UPDATE_ICON) |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5097 { |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5098 gaim_gtkconv_update_buddy_icon(conv); |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5099 } |
4359 | 5100 } |
5101 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5102 static GaimConversationUiOps conversation_ui_ops = |
4359 | 5103 { |
5104 gaim_gtkconv_destroy, /* destroy_conversation */ | |
5105 gaim_gtkconv_write_chat, /* write_chat */ | |
5106 gaim_gtkconv_write_im, /* write_im */ | |
5107 gaim_gtkconv_write_conv, /* write_conv */ | |
5108 gaim_gtkconv_chat_add_user, /* chat_add_user */ | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5109 gaim_gtkconv_chat_add_users, /* chat_add_users */ |
4359 | 5110 gaim_gtkconv_chat_rename_user, /* chat_rename_user */ |
5111 gaim_gtkconv_chat_remove_user, /* chat_remove_user */ | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5112 gaim_gtkconv_chat_remove_users, /* chat_remove_users */ |
4359 | 5113 gaim_gtkconv_set_title, /* set_title */ |
5114 NULL, /* update_progress */ | |
5115 gaim_gtkconv_updated /* updated */ | |
5116 }; | |
5117 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5118 GaimConversationUiOps * |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
5119 gaim_gtk_conversations_get_conv_ui_ops(void) |
4359 | 5120 { |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
5121 return &conversation_ui_ops; |
4359 | 5122 } |
5123 | |
5124 /************************************************************************** | |
5125 * Public conversation utility functions | |
5126 **************************************************************************/ | |
5127 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5128 remove_icon(GaimGtkConversation *gtkconv) |
4359 | 5129 { |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5130 g_return_if_fail(gtkconv != NULL); |
4359 | 5131 |
5132 if (gtkconv->u.im->icon != NULL) | |
5133 gtk_container_remove(GTK_CONTAINER(gtkconv->bbox), | |
5134 gtkconv->u.im->icon->parent->parent); | |
5135 | |
5136 if (gtkconv->u.im->anim != NULL) | |
4793 | 5137 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); |
4359 | 5138 |
5139 if (gtkconv->u.im->icon_timer != 0) | |
5140 g_source_remove(gtkconv->u.im->icon_timer); | |
5141 | |
5142 if (gtkconv->u.im->iter != NULL) | |
5143 g_object_unref(G_OBJECT(gtkconv->u.im->iter)); | |
5144 | |
5145 gtkconv->u.im->icon_timer = 0; | |
5146 gtkconv->u.im->icon = NULL; | |
5147 gtkconv->u.im->anim = NULL; | |
5148 gtkconv->u.im->iter = NULL; | |
5149 } | |
5150 | |
5151 static gboolean | |
5152 redraw_icon(gpointer data) | |
5153 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5154 GaimConversation *conv = (GaimConversation *)data; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5155 GaimGtkConversation *gtkconv; |
4359 | 5156 |
5157 GdkPixbuf *buf; | |
5158 GdkPixbuf *scale; | |
5159 GdkPixmap *pm; | |
5160 GdkBitmap *bm; | |
5161 gint delay; | |
5162 | |
5163 if (!g_list_find(gaim_get_ims(), conv)) { | |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5164 gaim_debug(GAIM_DEBUG_WARNING, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5165 "Conversation not found in redraw_icon. I think this " |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5166 "is a bug.\n"); |
4359 | 5167 return FALSE; |
5168 } | |
5169 | |
5170 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5171 | |
5172 gdk_pixbuf_animation_iter_advance(gtkconv->u.im->iter, NULL); | |
5173 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); | |
5174 | |
5175 scale = gdk_pixbuf_scale_simple(buf, | |
5176 MAX(gdk_pixbuf_get_width(buf) * SCALE(gtkconv->u.im->anim) / | |
5177 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), | |
5178 MAX(gdk_pixbuf_get_height(buf) * SCALE(gtkconv->u.im->anim) / | |
5179 gdk_pixbuf_animation_get_height(gtkconv->u.im->anim), 1), | |
5180 GDK_INTERP_NEAREST); | |
5181 | |
5182 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); | |
4793 | 5183 g_object_unref(G_OBJECT(scale)); |
4635 | 5184 gtk_image_set_from_pixmap(GTK_IMAGE(gtkconv->u.im->icon), pm, bm); |
4793 | 5185 g_object_unref(G_OBJECT(pm)); |
4359 | 5186 gtk_widget_queue_draw(gtkconv->u.im->icon); |
5187 | |
5188 if (bm) | |
4793 | 5189 g_object_unref(G_OBJECT(bm)); |
4359 | 5190 |
5191 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter) / 10; | |
5192 | |
5193 gtkconv->u.im->icon_timer = g_timeout_add(delay * 10, redraw_icon, conv); | |
5194 | |
5195 return FALSE; | |
5196 } | |
5197 | |
5198 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5199 start_anim(GtkObject *obj, GaimConversation *conv) |
4359 | 5200 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5201 GaimGtkConversation *gtkconv; |
4359 | 5202 int delay; |
5203 | |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5204 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
4359 | 5205 return; |
5206 | |
5207 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5208 | |
6016 | 5209 if (gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim)) |
5210 return; | |
5211 | |
4359 | 5212 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter) / 10; |
5213 | |
5214 if (gtkconv->u.im->anim) | |
5215 gtkconv->u.im->icon_timer = g_timeout_add(delay * 10, redraw_icon, | |
5216 conv); | |
5217 } | |
5218 | |
5219 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5220 stop_anim(GtkObject *obj, GaimConversation *conv) |
4359 | 5221 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5222 GaimGtkConversation *gtkconv; |
4359 | 5223 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5224 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
4359 | 5225 return; |
5226 | |
5227 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5228 | |
5229 if (gtkconv->u.im->icon_timer != 0) | |
5230 g_source_remove(gtkconv->u.im->icon_timer); | |
5231 | |
5232 gtkconv->u.im->icon_timer = 0; | |
5233 } | |
5234 | |
7300
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5235 static void |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5236 toggle_icon_animate_cb(GtkWidget *w, GaimConversation *conv) |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5237 { |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5238 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
|
5239 start_anim(NULL, conv); |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5240 else |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5241 stop_anim(NULL, conv); |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5242 } |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5243 |
4359 | 5244 static gboolean |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5245 icon_menu(GtkObject *obj, GdkEventButton *e, GaimConversation *conv) |
4359 | 5246 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5247 GaimGtkConversation *gtkconv; |
4359 | 5248 static GtkWidget *menu = NULL; |
5249 GtkWidget *button; | |
5250 | |
5251 if (e->button != 3 || e->type != GDK_BUTTON_PRESS) | |
5252 return FALSE; | |
5253 | |
5254 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5255 | |
5256 /* | |
5257 * If a menu already exists, destroy it before creating a new one, | |
5258 * thus freeing-up the memory it occupied. | |
5259 */ | |
5260 if (menu != NULL) | |
5261 gtk_widget_destroy(menu); | |
5262 | |
5263 menu = gtk_menu_new(); | |
5264 | |
7300
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5265 if (gtkconv->u.im->anim && |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5266 !(gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim))) |
4359 | 5267 { |
7300
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5268 gaim_new_check_item(menu, _("Animate"), |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5269 G_CALLBACK(toggle_icon_animate_cb), conv, |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5270 gtkconv->u.im->icon_timer); |
4359 | 5271 } |
5272 | |
5273 button = gtk_menu_item_new_with_label(_("Hide Icon")); | |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
5274 g_signal_connect_swapped(G_OBJECT(button), "activate", |
4515
9b9737a00a96
[gaim-migrate @ 4793]
Christian Hammond <chipx86@chipx86.com>
parents:
4513
diff
changeset
|
5275 G_CALLBACK(remove_icon), gtkconv); |
4359 | 5276 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); |
5277 gtk_widget_show(button); | |
5278 | |
7300
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5279 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
|
5280 G_CALLBACK(gaim_gtk_save_icon_dialog), conv, |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5281 0, 0, NULL); |
4359 | 5282 |
5283 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, e->button, e->time); | |
5284 | |
5285 return TRUE; | |
5286 } | |
5287 | |
5288 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5289 gaim_gtkconv_update_buddy_icon(GaimConversation *conv) |
4359 | 5290 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5291 GaimGtkConversation *gtkconv; |
7143 | 5292 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); |
4359 | 5293 |
5294 char filename[256]; | |
5295 FILE *file; | |
5296 GError *err = NULL; | |
5462
8355eeeb52a3
[gaim-migrate @ 5853]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
5297 gboolean animate = TRUE; |
4359 | 5298 |
6695 | 5299 GaimBuddy *buddy; |
4757 | 5300 |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5301 const void *data; |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5302 size_t len; |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5303 int delay; |
4359 | 5304 |
5305 GdkPixbuf *buf; | |
5306 | |
5307 GtkWidget *event; | |
5308 GtkWidget *frame; | |
5309 GdkPixbuf *scale; | |
5310 GdkPixmap *pm; | |
5311 GdkBitmap *bm; | |
5312 int sf = 0; | |
5313 | |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5314 g_return_if_fail(conv != NULL); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5315 g_return_if_fail(GAIM_IS_GTK_CONVERSATION(conv)); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5316 g_return_if_fail(gaim_conversation_get_type(conv) == GAIM_CONV_IM); |
4359 | 5317 |
5318 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5319 | |
5462
8355eeeb52a3
[gaim-migrate @ 5853]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
5320 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
|
5321 animate = FALSE; |
8355eeeb52a3
[gaim-migrate @ 5853]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
5322 |
4359 | 5323 remove_icon(gtkconv); |
5324 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5325 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/im/show_buddy_icons")) |
4359 | 5326 return; |
5327 | |
5328 if (gaim_conversation_get_gc(conv) == NULL) | |
5329 return; | |
5330 | |
4793 | 5331 if(gtkconv->u.im->anim) |
5332 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); | |
5333 | |
4757 | 5334 if((buddy = gaim_find_buddy(gaim_conversation_get_account(conv), |
5335 gaim_conversation_get_name(conv))) != NULL) { | |
7125 | 5336 const char *file; |
7693 | 5337 if((file = gaim_blist_node_get_string((GaimBlistNode*)buddy, "buddy_icon"))) |
4757 | 5338 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
|
5339 } |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5340 else |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5341 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5342 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
|
5343 |
6877
1b5b0cea6915
[gaim-migrate @ 7423]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
5344 if (icon == NULL) |
1b5b0cea6915
[gaim-migrate @ 7423]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
5345 return; |
1b5b0cea6915
[gaim-migrate @ 7423]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
5346 |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5347 data = gaim_buddy_icon_get_data(icon, &len); |
4757 | 5348 |
5349 /* this is such an evil hack, i don't know why i'm even considering it. | |
5350 * we'll do it differently when gdk-pixbuf-loader isn't leaky anymore. */ | |
5351 g_snprintf(filename, sizeof(filename), | |
5352 "%s" G_DIR_SEPARATOR_S "gaimicon-%s.%d", | |
5353 g_get_tmp_dir(), gaim_conversation_get_name(conv), getpid()); | |
5354 | |
5355 if (!(file = fopen(filename, "wb"))) | |
5356 return; | |
5357 | |
5358 fwrite(data, 1, len, file); | |
5359 fclose(file); | |
5360 | |
5361 gtkconv->u.im->anim = gdk_pixbuf_animation_new_from_file(filename, &err); | |
5362 /* make sure we remove the file as soon as possible */ | |
5363 unlink(filename); | |
5364 } | |
4359 | 5365 |
5366 if (err) { | |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5367 gaim_debug(GAIM_DEBUG_ERROR, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5368 "Buddy icon error: %s\n", err->message); |
4359 | 5369 g_error_free(err); |
5370 } | |
5371 | |
5372 | |
5373 if (!gtkconv->u.im->anim) | |
5374 return; | |
5375 | |
4793 | 5376 if(gtkconv->u.im->iter) |
5377 g_object_unref(G_OBJECT(gtkconv->u.im->iter)); | |
5378 | |
4359 | 5379 if (gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim)) { |
5380 gtkconv->u.im->iter = NULL; | |
5381 delay = 0; | |
5382 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); | |
5383 } else { | |
5384 gtkconv->u.im->iter = | |
5385 gdk_pixbuf_animation_get_iter(gtkconv->u.im->anim, NULL); | |
5386 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); | |
5387 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter); | |
5388 delay = delay / 10; | |
5389 } | |
5390 | |
5391 sf = SCALE(gtkconv->u.im->anim); | |
5392 scale = gdk_pixbuf_scale_simple(buf, | |
5393 MAX(gdk_pixbuf_get_width(buf) * sf / | |
5394 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), | |
5395 MAX(gdk_pixbuf_get_height(buf) * sf / | |
5396 gdk_pixbuf_animation_get_height(gtkconv->u.im->anim), 1), | |
5397 GDK_INTERP_NEAREST); | |
5398 | |
5399 if (delay) | |
5400 gtkconv->u.im->icon_timer = g_timeout_add(delay * 10, redraw_icon, | |
5401 conv); | |
5402 | |
5403 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); | |
4793 | 5404 g_object_unref(G_OBJECT(scale)); |
4359 | 5405 |
5406 frame = gtk_frame_new(NULL); | |
5407 gtk_frame_set_shadow_type(GTK_FRAME(frame), | |
5408 (bm ? GTK_SHADOW_NONE : GTK_SHADOW_IN)); | |
5409 gtk_box_pack_start(GTK_BOX(gtkconv->bbox), frame, FALSE, FALSE, 5); | |
5410 gtk_box_reorder_child(GTK_BOX(gtkconv->bbox), frame, 0); | |
5411 gtk_widget_show(frame); | |
5412 | |
5413 event = gtk_event_box_new(); | |
5414 gtk_container_add(GTK_CONTAINER(frame), event); | |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
5415 g_signal_connect(G_OBJECT(event), "button-press-event", |
4359 | 5416 G_CALLBACK(icon_menu), conv); |
5417 gtk_widget_show(event); | |
5418 | |
4635 | 5419 gtkconv->u.im->icon = gtk_image_new_from_pixmap(pm, bm); |
4359 | 5420 gtk_widget_set_size_request(gtkconv->u.im->icon, sf, sf); |
5421 gtk_container_add(GTK_CONTAINER(event), gtkconv->u.im->icon); | |
5422 gtk_widget_show(gtkconv->u.im->icon); | |
5423 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5424 if (!animate || |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5425 !gaim_prefs_get_bool("/gaim/gtk/conversations/im/animate_buddy_icons")) { |
4359 | 5426 stop_anim(NULL, conv); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5427 } |
4359 | 5428 |
4793 | 5429 g_object_unref(G_OBJECT(pm)); |
4359 | 5430 |
5431 if (bm) | |
4793 | 5432 g_object_unref(G_OBJECT(bm)); |
7143 | 5433 |
5434 /* The buddy icon code needs badly to be fixed. */ | |
5435 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); | |
5436 gtk_window_set_icon(GTK_WINDOW(gtkwin->window), buf); | |
4359 | 5437 } |
5438 | |
5439 void | |
5440 gaim_gtkconv_update_font_buttons(void) | |
5441 { | |
5442 GList *l; | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5443 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5444 GaimGtkConversation *gtkconv; |
4359 | 5445 |
5446 for (l = gaim_get_ims(); l != NULL; l = l->next) { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5447 conv = (GaimConversation *)l->data; |
4359 | 5448 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5449 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
4359 | 5450 continue; |
5451 | |
5452 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5453 | |
5454 if (gtkconv->toolbar.bold != NULL) | |
5455 gtk_widget_set_sensitive(gtkconv->toolbar.bold, | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5456 !gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold")); |
4359 | 5457 |
5458 if (gtkconv->toolbar.italic != NULL) | |
5459 gtk_widget_set_sensitive(gtkconv->toolbar.italic, | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5460 !gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic")); |
4359 | 5461 |
5462 if (gtkconv->toolbar.underline != NULL) | |
5463 gtk_widget_set_sensitive(gtkconv->toolbar.underline, | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5464 !gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline")); |
4359 | 5465 } |
5466 } | |
5467 | |
5468 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5469 gaim_gtkconv_update_font_colors(GaimConversation *conv) |
4421 | 5470 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5471 GaimGtkConversation *gtkconv; |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
5472 |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5473 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5474 return; |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
5475 |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5476 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5477 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5478 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5479 >kconv->fg_color); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5480 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5481 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5482 >kconv->bg_color); |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5483 } |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5484 |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5485 void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5486 gaim_gtkconv_update_font_face(GaimConversation *conv) |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5487 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5488 GaimGtkConversation *gtkconv; |
6141 | 5489 |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5490 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5491 return; |
6141 | 5492 |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5493 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
5494 |
6141 | 5495 strncpy(gtkconv->fontface, |
5496 gaim_prefs_get_string("/gaim/gtk/conversations/font_face"), | |
5497 sizeof(gtkconv->fontface)); | |
4421 | 5498 } |
5499 | |
5500 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5501 gaim_gtkconv_update_buttons_by_protocol(GaimConversation *conv) |
4359 | 5502 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5503 GaimConvWindow *win; |
4359 | 5504 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5505 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
4359 | 5506 return; |
5507 | |
7887 | 5508 win = gaim_conversation_get_window(conv); |
5509 | |
5510 if (win != NULL && gaim_conv_window_get_active_conversation(win) == conv) | |
5511 gray_stuff_out(conv); | |
4359 | 5512 } |
5513 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5514 GaimConvWindow * |
4359 | 5515 gaim_gtkwin_get_at_xy(int x, int y) |
5516 { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5517 GaimConvWindow *win = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5518 GaimGtkWindow *gtkwin; |
4359 | 5519 GdkWindow *gdkwin; |
5520 GList *l; | |
5521 | |
5522 gdkwin = gdk_window_at_pointer(&x, &y); | |
5523 | |
5524 if (gdkwin) | |
5525 gdkwin = gdk_window_get_toplevel(gdkwin); | |
5526 | |
5527 for (l = gaim_get_windows(); l != NULL; l = l->next) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5528 win = (GaimConvWindow *)l->data; |
4359 | 5529 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5530 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5531 continue; |
5532 | |
5533 gtkwin = GAIM_GTK_WINDOW(win); | |
5534 | |
5535 if (gdkwin == gtkwin->window->window) | |
5536 return win; | |
5537 } | |
5538 | |
5539 return NULL; | |
5540 } | |
5541 | |
5542 int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5543 gaim_gtkconv_get_tab_at_xy(GaimConvWindow *win, int x, int y) |
4359 | 5544 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5545 GaimGtkWindow *gtkwin; |
4359 | 5546 GList *l; |
5547 gint nb_x, nb_y, x_rel, y_rel; | |
5548 GtkNotebook *notebook; | |
5549 GtkWidget *tab; | |
5550 gint i, page_num = 0; | |
5551 gboolean first_visible = TRUE; | |
5552 | |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5553 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5554 return -1; |
5555 | |
5556 gtkwin = GAIM_GTK_WINDOW(win); | |
5557 notebook = GTK_NOTEBOOK(gtkwin->notebook); | |
5558 | |
5559 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
5560 x_rel = x - nb_x; | |
5561 y_rel = y - nb_y; | |
5562 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5563 for (l = gaim_conv_window_get_conversations(win), i = 0; |
4359 | 5564 l != NULL; |
5565 l = l->next, i++) { | |
5566 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5567 GaimConversation *conv = l->data; |
4359 | 5568 tab = GAIM_GTK_CONVERSATION(conv)->tab_label; |
5569 | |
5570 if (!GTK_WIDGET_MAPPED(tab)) | |
5571 continue; | |
5572 | |
5573 if (first_visible) { | |
5574 first_visible = FALSE; | |
5575 | |
5576 if (x_rel < tab->allocation.x) x_rel = tab->allocation.x; | |
5577 if (y_rel < tab->allocation.y) y_rel = tab->allocation.y; | |
5578 } | |
5579 | |
5580 if (gtk_notebook_get_tab_pos(notebook) == GTK_POS_TOP || | |
5581 gtk_notebook_get_tab_pos(notebook) == GTK_POS_BOTTOM) { | |
5582 | |
5583 if (tab->allocation.x <= x_rel) { | |
5584 if (tab->allocation.x + tab->allocation.width <= x_rel) | |
5585 page_num = i + 1; | |
5586 else | |
5587 page_num = i; | |
5588 } | |
5589 else | |
5590 break; | |
5591 } | |
5592 else { | |
5593 if (tab->allocation.y <= y_rel) { | |
5594 if (tab->allocation.y + tab->allocation.height <= y_rel) | |
5595 page_num = i + 1; | |
5596 else | |
5597 page_num = i; | |
5598 } | |
5599 else | |
5600 break; | |
5601 } | |
5602 } | |
5603 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5604 if (i == gaim_conv_window_get_conversation_count(win) + 1) |
4359 | 5605 return -1; |
5606 | |
5607 return page_num; | |
5608 } | |
5609 | |
5610 int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5611 gaim_gtkconv_get_dest_tab_at_xy(GaimConvWindow *win, int x, int y) |
4359 | 5612 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5613 GaimGtkWindow *gtkwin; |
4359 | 5614 GList *l; |
5615 gint nb_x, nb_y, x_rel, y_rel; | |
5616 GtkNotebook *notebook; | |
5617 GtkWidget *tab; | |
5618 gint i, page_num = 0; | |
5619 | |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5620 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5621 return -1; |
5622 | |
5623 gtkwin = GAIM_GTK_WINDOW(win); | |
5624 notebook = GTK_NOTEBOOK(gtkwin->notebook); | |
5625 | |
5626 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
5627 x_rel = x - nb_x; | |
5628 y_rel = y - nb_y; | |
5629 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5630 for (l = gaim_conv_window_get_conversations(win), i = 0; |
4359 | 5631 l != NULL; |
5632 l = l->next, i++) { | |
5633 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5634 GaimConversation *conv = l->data; |
4359 | 5635 tab = GAIM_GTK_CONVERSATION(conv)->tab_label; |
5636 | |
5637 if (!GTK_WIDGET_MAPPED(tab)) | |
5638 continue; | |
5639 | |
5640 if (gtk_notebook_get_tab_pos(notebook) == GTK_POS_TOP || | |
5641 gtk_notebook_get_tab_pos(notebook) == GTK_POS_BOTTOM) { | |
5642 | |
5643 if (tab->allocation.x <= x_rel) { | |
5644 if (tab->allocation.x + (tab->allocation.width / 2) <= x_rel) | |
5645 page_num = i + 1; | |
5646 else | |
5647 page_num = i; | |
5648 } | |
5649 else | |
5650 break; | |
5651 } | |
5652 else { | |
5653 if (tab->allocation.y <= y_rel) { | |
5654 if (tab->allocation.y + (tab->allocation.height / 2) <= y_rel) | |
5655 page_num = i + 1; | |
5656 else | |
5657 page_num = i; | |
5658 } | |
5659 else | |
5660 break; | |
5661 } | |
5662 } | |
5663 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5664 if (i == gaim_conv_window_get_conversation_count(win) + 1) |
4359 | 5665 return -1; |
5666 | |
5667 return page_num; | |
5668 } | |
4940
3708545afe42
[gaim-migrate @ 5274]
Christian Hammond <chipx86@chipx86.com>
parents:
4939
diff
changeset
|
5669 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5670 static void |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5671 escape_closes_pref_cb(const char *name, GaimPrefType type, gpointer value, |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5672 gpointer data) |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5673 { |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5674 if (value) |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5675 gtk_accel_map_change_entry(N_("<main>/Conversation/Close"), |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5676 GDK_Escape, 0, TRUE); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5677 else |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5678 gtk_accel_map_change_entry(N_("<main>/Conversation/Close"), |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5679 GDK_W, GDK_CONTROL_MASK, TRUE); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5680 } |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5681 |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5682 static void |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5683 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
|
5684 gpointer data) |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5685 { |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5686 GList *l; |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5687 GaimConversation *conv; |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5688 GaimGtkConversation *gtkconv; |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5689 |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5690 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5691 conv = (GaimConversation *)l->data; |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5692 |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5693 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5694 continue; |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5695 |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5696 gtkconv = GAIM_GTK_CONVERSATION(conv); |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5697 |
6440 | 5698 if (value) { |
5699 update_tab_icon(conv); | |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5700 gtk_widget_show(gtkconv->icon); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
5701 gtk_widget_show(gtkconv->menu_icon); |
6440 | 5702 } |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
5703 else { |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5704 gtk_widget_hide(gtkconv->icon); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
5705 gtk_widget_hide(gtkconv->menu_icon); |
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
5706 } |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5707 } |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5708 } |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5709 |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5710 static void |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5711 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
|
5712 gpointer data) |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5713 { |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5714 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5715 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5716 GaimGtkConversation *gtkconv; |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5717 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5718 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5719 conv = (GaimConversation *)l->data; |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5720 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5721 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5722 continue; |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5723 |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5724 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5725 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5726 if (value) |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5727 gtk_widget_show(gtkconv->close); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5728 else |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5729 gtk_widget_hide(gtkconv->close); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5730 } |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5731 } |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5732 |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5733 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5734 show_timestamps_pref_cb(const char *name, GaimPrefType type, gpointer value, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5735 gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5736 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5737 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5738 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5739 GaimGtkConversation *gtkconv; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5740 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5741 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5742 conv = (GaimConversation *)l->data; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5743 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5744 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5745 continue; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5746 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5747 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5748 |
7386 | 5749 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
|
5750 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5751 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5752 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5753 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5754 spellcheck_pref_cb(const char *name, GaimPrefType type, gpointer value, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5755 gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5756 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5757 #ifdef USE_GTKSPELL |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5758 GList *cl; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5759 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5760 GaimGtkConversation *gtkconv; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5761 GtkSpell *spell; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5762 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5763 for (cl = gaim_get_conversations(); cl != NULL; cl = cl->next) { |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
5764 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5765 conv = (GaimConversation *)cl->data; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5766 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5767 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5768 continue; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5769 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5770 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5771 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5772 if (value) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
5773 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5774 else { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5775 spell = gtkspell_get_from_text_view(GTK_TEXT_VIEW(gtkconv->entry)); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5776 gtkspell_detach(spell); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5777 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5778 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5779 #endif |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5780 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5781 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5782 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5783 show_smileys_pref_cb(const char *name, GaimPrefType type, gpointer value, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5784 gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5785 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5786 GList *cl; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5787 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5788 GaimGtkConversation *gtkconv; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5789 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5790 for (cl = gaim_get_conversations(); cl != NULL; cl = cl->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5791 conv = (GaimConversation *)cl->data; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5792 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5793 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5794 continue; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5795 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5796 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5797 |
7386 | 5798 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
|
5799 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5800 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5801 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5802 static void |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5803 tab_side_pref_cb(const char *name, GaimPrefType type, gpointer value, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5804 gpointer data) |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5805 { |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5806 GList *l; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5807 GtkPositionType pos; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5808 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5809 GaimGtkWindow *gtkwin; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5810 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5811 pos = GPOINTER_TO_INT(value); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5812 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5813 for (l = gaim_get_windows(); l != NULL; l = l->next) { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5814 win = (GaimConvWindow *)l->data; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5815 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5816 if (!GAIM_IS_GTK_WINDOW(win)) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5817 continue; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5818 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5819 gtkwin = GAIM_GTK_WINDOW(win); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5820 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5821 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5822 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5823 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5824 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5825 static void |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5826 show_formatting_toolbar_pref_cb(const char *name, GaimPrefType type, |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5827 gpointer value, gpointer data) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5828 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5829 GList *l; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5830 GaimConversation *conv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5831 GaimGtkConversation *gtkconv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5832 GaimConvWindow *win; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5833 GaimGtkWindow *gtkwin; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5834 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5835 for (l = gaim_get_conversations(); l != NULL; l = l->next) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5836 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5837 conv = (GaimConversation *)l->data; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5838 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5839 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5840 continue; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5841 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5842 gtkconv = GAIM_GTK_CONVERSATION(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5843 win = gaim_conversation_get_window(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5844 gtkwin = GAIM_GTK_WINDOW(win); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5845 |
7386 | 5846 gtkconv->show_formatting_toolbar = (gboolean)GPOINTER_TO_INT(value); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5847 gtk_check_menu_item_set_active( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5848 GTK_CHECK_MENU_ITEM(gtkwin->menu.show_formatting_toolbar), |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5849 gtkconv->show_formatting_toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5850 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5851 if (gtkconv->show_formatting_toolbar) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5852 gtk_widget_show(gtkconv->toolbar.toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5853 else |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5854 gtk_widget_hide(gtkconv->toolbar.toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5855 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5856 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5857 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5858 static void |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5859 im_button_type_pref_cb(const char *name, GaimPrefType type, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5860 gpointer value, gpointer data) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5861 { |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5862 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5863 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5864 GaimGtkConversation *gtkconv; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5865 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5866 for (l = gaim_get_ims(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5867 conv = (GaimConversation *)l->data; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5868 gtkconv = GAIM_GTK_CONVERSATION(conv); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5869 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5870 setup_im_buttons(conv, gtk_widget_get_parent(gtkconv->send)); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5871 } |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5872 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5873 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5874 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5875 animate_buddy_icons_pref_cb(const char *name, GaimPrefType type, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5876 gpointer value, gpointer data) |
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 GList *l; |
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 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
|
5881 return; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5882 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5883 if (value) { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5884 for (l = gaim_get_ims(); l != NULL; l = l->next) |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5885 start_anim(NULL, (GaimConversation *)l->data); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5886 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5887 else { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5888 for (l = gaim_get_ims(); l != NULL; l = l->next) |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5889 stop_anim(NULL, (GaimConversation *)l->data); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5890 } |
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 |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5893 static void |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5894 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
|
5895 gpointer data) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5896 { |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5897 GList *l; |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5898 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5899 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5900 GaimConversation *conv = l->data; |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5901 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5902 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5903 gaim_conversation_foreach(gaim_gtkconv_update_buddy_icon); |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5904 } |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5905 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5906 |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5680
diff
changeset
|
5907 static void |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5908 chat_button_type_pref_cb(const char *name, GaimPrefType type, gpointer value, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5909 gpointer data) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5910 { |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5911 GList *l; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5912 GaimConnection *g; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5913 GtkWidget *parent; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5914 GaimConversationType conv_type = GAIM_CONV_CHAT; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5915 GSList *bcs; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5916 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5917 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5918 GaimGtkWindow *gtkwin; |
5675
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 for (l = gaim_connections_get_all(); l != NULL; l = l->next) { |
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 g = (GaimConnection *)l->data; |
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 for (bcs = g->buddy_chats; bcs != NULL; bcs = bcs->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5925 conv = (GaimConversation *)bcs->data; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5926 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5927 if (gaim_conversation_get_type(conv) != GAIM_CONV_CHAT) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5928 continue; |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
5929 |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5930 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5931 continue; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5932 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5933 gtkconv = GAIM_GTK_CONVERSATION(conv); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5934 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5935 parent = gtk_widget_get_parent(gtkconv->send); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5936 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5937 gtkconv->send = |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5938 gaim_gtk_change_text(_("Send"), |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5939 gtkconv->send, GAIM_STOCK_SEND, conv_type); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5940 gtkconv->u.chat->invite = |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5941 gaim_gtk_change_text(_("Invite"), |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5942 gtkconv->u.chat->invite, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5943 GAIM_STOCK_INVITE, conv_type); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5944 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5945 gtk_box_pack_end(GTK_BOX(parent), gtkconv->send, FALSE, FALSE, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5946 conv_type); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5947 gtk_box_pack_end(GTK_BOX(parent), gtkconv->u.chat->invite, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5948 FALSE, FALSE, 0); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5949 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5950 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->send, 0); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5951 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5952 g_signal_connect(G_OBJECT(gtkconv->send), "clicked", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5953 G_CALLBACK(send_cb), conv); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5954 g_signal_connect(G_OBJECT(gtkconv->u.chat->invite), "clicked", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5955 G_CALLBACK(invite_cb), conv); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5956 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5957 gtk_button_set_relief(GTK_BUTTON(gtkconv->send), |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5958 GTK_RELIEF_NONE); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5959 gtk_button_set_relief(GTK_BUTTON(gtkconv->u.chat->invite), |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5960 GTK_RELIEF_NONE); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5961 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5962 gaim_gtkconv_update_buttons_by_protocol(conv); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5963 } |
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 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5966 |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5967 static void |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5968 conv_placement_pref_cb(const char *name, GaimPrefType type, |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5969 gpointer value, gpointer data) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5970 { |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5971 GaimConvPlacementFunc func; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5972 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5973 if (strcmp(name, "/gaim/gtk/conversations/placement")) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5974 return; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5975 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5976 func = gaim_conv_placement_get_fnc(value); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5977 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5978 if (func == NULL) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5979 return; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5980 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5981 gaim_conv_placement_set_current_func(func); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5982 } |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
5983 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5984 void |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
5985 gaim_gtk_conversations_init(void) |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5986 { |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5987 /* Conversations */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5988 gaim_prefs_add_none("/gaim/gtk/conversations"); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5989 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
|
5990 gaim_prefs_add_bool("/gaim/gtk/conversations/close_on_tabs", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5991 gaim_prefs_add_bool("/gaim/gtk/conversations/ctrl_enter_sends", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5992 gaim_prefs_add_bool("/gaim/gtk/conversations/enter_sends", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5993 gaim_prefs_add_bool("/gaim/gtk/conversations/escape_closes", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5994 gaim_prefs_add_bool("/gaim/gtk/conversations/send_bold", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5995 gaim_prefs_add_bool("/gaim/gtk/conversations/send_italic", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5996 gaim_prefs_add_bool("/gaim/gtk/conversations/send_strikethrough", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5997 gaim_prefs_add_bool("/gaim/gtk/conversations/send_underline", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5998 gaim_prefs_add_bool("/gaim/gtk/conversations/show_smileys", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5999 gaim_prefs_add_bool("/gaim/gtk/conversations/show_timestamps", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6000 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
|
6001 gaim_prefs_add_bool("/gaim/gtk/conversations/spellcheck", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6002 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_colors", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6003 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_fonts", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6004 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_font_sizes", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6005 gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_bgcolor", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6006 gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_fgcolor", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6007 gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_font", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6008 gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_size", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6009 gaim_prefs_add_bool("/gaim/gtk/conversations/html_shortcuts", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6010 gaim_prefs_add_bool("/gaim/gtk/conversations/smiley_shortcuts", FALSE); |
5743
af159a5bbaa0
[gaim-migrate @ 6167]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
6011 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
|
6012 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
|
6013 gaim_prefs_add_string("/gaim/gtk/conversations/placement", "last"); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6014 gaim_prefs_add_string("/gaim/gtk/conversations/bgcolor", "#FFFFFF"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6015 gaim_prefs_add_string("/gaim/gtk/conversations/fgcolor", "#000000"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6016 gaim_prefs_add_string("/gaim/gtk/conversations/font_face", ""); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6017 gaim_prefs_add_int("/gaim/gtk/conversations/font_size", 3); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6018 gaim_prefs_add_bool("/gaim/gtk/conversations/tabs", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6019 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
|
6020 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6021 /* Conversations -> Chat */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6022 gaim_prefs_add_none("/gaim/gtk/conversations/chat"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6023 gaim_prefs_add_int("/gaim/gtk/conversations/chat/button_type", |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6024 GAIM_BUTTON_TEXT_IMAGE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6025 gaim_prefs_add_bool("/gaim/gtk/conversations/chat/color_nicks", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6026 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
|
6027 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
|
6028 gaim_prefs_add_bool("/gaim/gtk/conversations/chat/tab_completion", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6029 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_width", 410); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6030 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_height", 160); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6031 gaim_prefs_add_int("/gaim/gtk/conversations/chat/entry_height", 50); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6032 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6033 /* Conversations -> IM */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6034 gaim_prefs_add_none("/gaim/gtk/conversations/im"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6035 gaim_prefs_add_int("/gaim/gtk/conversations/im/button_type", |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6036 GAIM_BUTTON_TEXT_IMAGE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6037 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
|
6038 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
|
6039 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
|
6040 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
|
6041 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_width", 410); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6042 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_height", 160); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6043 gaim_prefs_add_int("/gaim/gtk/conversations/im/entry_height", 50); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6044 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6045 /* Connect callbacks. */ |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6046 gaim_prefs_connect_callback("/gaim/gtk/conversations/escape_closes", |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6047 escape_closes_pref_cb, NULL); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
6048 gaim_prefs_connect_callback("/gaim/gtk/conversations/icons_on_tabs", |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
6049 icons_on_tabs_pref_cb, NULL); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6050 gaim_prefs_connect_callback("/gaim/gtk/conversations/close_on_tabs", |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6051 close_on_tabs_pref_cb, NULL); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6052 gaim_prefs_connect_callback("/gaim/gtk/conversations/show_smileys", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6053 show_smileys_pref_cb, NULL); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6054 gaim_prefs_connect_callback("/gaim/gtk/conversations/show_timestamps", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6055 show_timestamps_pref_cb, NULL); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6056 gaim_prefs_connect_callback("/gaim/gtk/conversations/show_formatting_toolbar", |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6057 show_formatting_toolbar_pref_cb, NULL); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6058 gaim_prefs_connect_callback("/gaim/gtk/conversations/spellcheck", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6059 spellcheck_pref_cb, NULL); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6060 gaim_prefs_connect_callback("/gaim/gtk/conversations/tab_side", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6061 tab_side_pref_cb, NULL); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6062 |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6063 gaim_prefs_connect_callback("/gaim/gtk/conversations/placement", |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6064 conv_placement_pref_cb, NULL); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6065 gaim_prefs_trigger_callback("/gaim/gtk/conversations/placement"); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6066 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6067 |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
6068 |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6069 /* IM callbacks */ |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6070 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/button_type", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6071 im_button_type_pref_cb, NULL); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6072 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/animate_buddy_icons", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6073 animate_buddy_icons_pref_cb, NULL); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6074 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/show_buddy_icons", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6075 show_buddy_icons_pref_cb, NULL); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6076 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6077 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6078 /* Chat callbacks */ |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6079 gaim_prefs_connect_callback("/gaim/gtk/conversations/chat/button_type", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6080 chat_button_type_pref_cb, NULL); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6081 } |