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