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