Mercurial > pidgin
annotate src/gtkconv.c @ 8006:45f37d7a20dc
[gaim-migrate @ 8683]
i should be shot for documenting such stupidity in code form
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Mon, 05 Jan 2004 07:31:37 +0000 |
parents | 934f5df83b29 |
children | fef1723f724a |
rev | line source |
---|---|
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
1 /** |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
2 * @file gtkconv.h GTK+ Conversation API |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
3 * @ingroup gtkui |
4359 | 4 * |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
5 * Copyright (C) 2002-2003 Christian Hammond <chipx86@gnupdate.org> |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
6 * |
4359 | 7 * This program is free software; you can redistribute it and/or modify |
8 * it under the terms of the GNU General Public License as published by | |
9 * the Free Software Foundation; either version 2 of the License, or | |
10 * (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, | |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 * GNU General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU General Public License | |
18 * along with this program; if not, write to the Free Software | |
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
20 * | |
21 */ | |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
22 #include "gtkinternal.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
23 |
4359 | 24 #ifndef _WIN32 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
25 # include <X11/Xlib.h> |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
26 #endif |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
27 |
4359 | 28 #ifdef USE_GTKSPELL |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
29 # include <gtkspell/gtkspell.h> |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
30 # ifdef _WIN32 |
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
31 # include "wspell.h" |
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
32 # endif |
4359 | 33 #endif |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
34 |
4359 | 35 #include <gdk/gdkkeysyms.h> |
6982 | 36 #include <locale.h> |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
37 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
38 #include "debug.h" |
6982 | 39 #include "imgstore.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
40 #include "log.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
41 #include "multi.h" |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5402
diff
changeset
|
42 #include "notify.h" |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
43 #include "prefs.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
44 #include "prpl.h" |
6038 | 45 #include "request.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
46 #include "sound.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
47 #include "util.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
48 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
49 #include "dnd-hints.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
50 #include "gtkblist.h" |
5717 | 51 #include "gtkconv.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
52 #include "gtkimhtml.h" |
7431 | 53 #include "gtklog.h" |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
54 #include "gtkpounce.h" |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
55 #include "gtkprivacy.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
56 #include "gtkutils.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
57 #include "stock.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
58 |
5717 | 59 #include "ui.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
60 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
61 /* XXX */ |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
62 #include "gaim.h" |
4359 | 63 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
64 #define AUTO_RESPONSE "<AUTO-REPLY> : " |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
65 |
7990 | 66 #define SEND_COLOR "#16569E" |
7855 | 67 #define RECV_COLOR "#A82F2F" |
7854 | 68 |
4359 | 69 static char nick_colors[][8] = { |
70 "#ba55d3", /* Medium Orchid */ | |
71 "#ee82ee", /* Violet */ | |
72 "#c715b4", /* Medium Violet Red */ | |
73 "#ff69b4", /* Hot Pink */ | |
74 "#ff6347", /* Tomato */ | |
75 "#fa8c00", /* Dark Orange */ | |
76 "#fa8072", /* Salmon */ | |
77 "#b22222", /* Fire Brick */ | |
78 "#f4a460", /* Sandy Brown */ | |
79 "#cd5c5c", /* Indian Red */ | |
80 "#bc8f8f", /* Rosy Brown */ | |
81 "#f0e68c", /* Khaki */ | |
82 "#bdb76b", /* Dark Khaki */ | |
83 "#228b22", /* Forest Green */ | |
84 "#9acd32", /* Yellow Green */ | |
85 "#32cd32", /* Lime Green */ | |
7755 | 86 "#3cb371", /* Medium Sea Green (Medium Sea Green?! What are we women?!) */ |
4359 | 87 "#2e8b57", /* Sea Green */ |
88 "#8fbc8f", /* Dark Sea Green */ | |
89 "#66cdaa", /* Medium Aquamarine */ | |
90 "#5f9ea0", /* Cadet Blue */ | |
91 "#48d1cc", /* Medium Turquoise */ | |
92 "#00ced1", /* Dark Turquoise */ | |
93 "#4682b4", /* Stell Blue */ | |
94 "#00bfff", /* Deep Sky Blue */ | |
95 "#1690ff", /* Dodger Blue */ | |
96 "#4169ff", /* Royal Blue */ | |
97 "#6a5acd", /* Slate Blue */ | |
98 "#6495ed", /* Cornflower Blue */ | |
99 "#708090", /* Slate gray */ | |
7995
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
100 "#2f4f4f", /* Dark Slate Gray */ |
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
101 "#ff8c00", /* Dark Orange */ |
4359 | 102 }; |
6291 | 103 |
4359 | 104 #define NUM_NICK_COLORS (sizeof(nick_colors) / sizeof(*nick_colors)) |
105 | |
106 #define SCALE(x) \ | |
107 ((gdk_pixbuf_animation_get_width(x) <= 48 && \ | |
108 gdk_pixbuf_animation_get_height(x) <= 48) ? 48 : 50) | |
109 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
110 typedef struct |
4359 | 111 { |
112 GtkWidget *window; | |
113 | |
114 GtkWidget *entry; | |
115 GtkWidget *message; | |
116 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
117 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
118 |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
119 } InviteBuddyInfo; |
4359 | 120 |
121 static GtkWidget *invite_dialog = NULL; | |
122 | |
123 /* Prototypes. <-- because Paco-Paco hates this comment. */ | |
124 static void check_everything(GtkTextBuffer *buffer); | |
4685 | 125 static void set_toggle(GtkWidget *tb, gboolean active); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
126 static void move_next_tab(GaimConversation *conv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
127 static void do_bold(GtkWidget *bold, GaimGtkConversation *gtkconv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
128 static void do_italic(GtkWidget *italic, GaimGtkConversation *gtkconv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
129 static void do_underline(GtkWidget *underline, GaimGtkConversation *gtkconv); |
7242
59ffe137176d
[gaim-migrate @ 7817]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7222
diff
changeset
|
130 static void do_small(GtkWidget *smalltb, GaimGtkConversation *gtkconv); |
59ffe137176d
[gaim-migrate @ 7817]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7222
diff
changeset
|
131 static void do_big(GtkWidget *large, GaimGtkConversation *gtkconv); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
132 static void toggle_font(GtkWidget *font, GaimConversation *conv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
133 static void toggle_fg_color(GtkWidget *color, GaimConversation *conv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
134 static void toggle_bg_color(GtkWidget *color, GaimConversation *conv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
135 static void got_typing_keypress(GaimConversation *conv, gboolean first); |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
136 static GList *generate_invite_user_names(GaimConnection *gc); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
137 static void add_chat_buddy_common(GaimConversation *conv, |
4359 | 138 const char *name, int pos); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
139 static void tab_complete(GaimConversation *conv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
140 static void update_typing_icon(GaimConversation *conv); |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
141 static gboolean update_send_as_selection(GaimConvWindow *win); |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
142 static char *item_factory_translate_func (const char *path, gpointer func_data); |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
143 static void save_convo(GtkWidget *save, GaimConversation *c); |
6440 | 144 static void update_tab_icon(GaimConversation *conv); |
4359 | 145 |
146 /************************************************************************** | |
147 * Callbacks | |
148 **************************************************************************/ | |
149 static void | |
6038 | 150 do_save_convo(GtkWidget *wid) |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
151 { |
6039 | 152 GaimConversation *c = g_object_get_data(G_OBJECT(GTK_FILE_SELECTION(wid)->ok_button), |
6038 | 153 "gaim_conversation"); |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
154 const char *filename; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
155 FILE *fp; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
156 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
157 filename = gtk_file_selection_get_filename(GTK_FILE_SELECTION(wid)); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
158 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
159 if (!((gaim_conversation_get_type(c) != GAIM_CONV_CHAT && |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
160 g_list_find(gaim_get_ims(), c)) || |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
161 (gaim_conversation_get_type(c) == GAIM_CONV_CHAT && |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
162 g_list_find(gaim_get_chats(), c)))) |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
163 filename = NULL; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
164 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
165 gtk_widget_destroy(wid); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
166 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
167 if (filename == NULL) |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
168 return; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
169 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
170 if ((fp = fopen(filename, "w+")) == NULL) |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
171 return; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
172 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
173 fprintf(fp, "%s", c->history->str); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
174 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
175 fclose(fp); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
176 } |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
177 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
178 static void |
6038 | 179 do_check_save_convo(GObject *obj, GtkWidget *wid) |
180 { | |
181 const char *filename = gtk_file_selection_get_filename(GTK_FILE_SELECTION(wid)); | |
182 | |
183 if (gaim_gtk_check_if_dir(filename, GTK_FILE_SELECTION(wid))) | |
184 return; | |
185 | |
186 if(g_file_test(filename, G_FILE_TEST_EXISTS)){ | |
187 gaim_request_yes_no(NULL, NULL, _("That file already exists"), | |
188 _("Would you like to overwrite it?"), 1, wid, | |
189 G_CALLBACK(do_save_convo), NULL); | |
190 } | |
191 else | |
192 do_save_convo(wid); | |
193 } | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6460
diff
changeset
|
194 |
6038 | 195 static void |
7927 | 196 do_insert_image_cb(GtkWidget *widget, int resp, gpointer data) |
4359 | 197 { |
7927 | 198 GaimConversation *conv = data; |
199 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); | |
200 GaimConvIm *im = GAIM_CONV_IM(conv); | |
6982 | 201 char *name, *filename; |
7927 | 202 char *buf, *filedata; |
6982 | 203 size_t size; |
7927 | 204 GError *error = NULL; |
4359 | 205 int id; |
206 | |
7927 | 207 if (resp != GTK_RESPONSE_OK) { |
208 set_toggle(gtkconv->toolbar.image, FALSE); | |
209 return; | |
210 } | |
211 | |
212 name = g_strdup(gtk_file_selection_get_filename(GTK_FILE_SELECTION(widget))); | |
6982 | 213 |
214 if (!name) { | |
7927 | 215 set_toggle(gtkconv->toolbar.image, FALSE); |
6982 | 216 return; |
217 } | |
218 | |
7927 | 219 if (gaim_gtk_check_if_dir(name, GTK_FILE_SELECTION(widget))) { |
6982 | 220 g_free(name); |
7927 | 221 set_toggle(gtkconv->toolbar.image, FALSE); |
4359 | 222 return; |
6982 | 223 } |
224 | |
7927 | 225 set_toggle(gtkconv->toolbar.image, FALSE); |
226 | |
227 if (!g_file_get_contents(name, &filedata, &size, &error)) { | |
6982 | 228 gaim_notify_error(NULL, NULL, error->message, NULL); |
229 | |
230 g_error_free(error); | |
231 g_free(name); | |
232 | |
4359 | 233 return; |
234 } | |
235 | |
236 filename = name; | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
237 while (strchr(filename, '/')) |
4359 | 238 filename = strchr(filename, '/') + 1; |
239 | |
7927 | 240 id = gaim_imgstore_add(filedata, size, filename); |
241 g_free(filedata); | |
6982 | 242 |
243 if (!id) { | |
244 buf = g_strdup_printf(_("Failed to store image: %s\n"), name); | |
245 gaim_notify_error(NULL, NULL, buf, NULL); | |
246 | |
247 g_free(buf); | |
248 g_free(name); | |
249 | |
250 return; | |
251 } | |
252 | |
253 im->images = g_slist_append(im->images, GINT_TO_POINTER(id)); | |
254 | |
255 buf = g_strdup_printf("<IMG ID=\"%d\" SRC=\"file://%s\">", id, filename); | |
256 gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(gtkconv->entry_buffer), buf, -1); | |
4359 | 257 g_free(buf); |
5046 | 258 |
6982 | 259 g_free(name); |
4359 | 260 } |
261 | |
262 static gint | |
263 close_win_cb(GtkWidget *w, GdkEventAny *e, gpointer d) | |
264 { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
265 GaimConvWindow *win = (GaimConvWindow *)d; |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
266 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
267 gaim_conv_window_destroy(win); |
4361
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
268 |
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
269 return TRUE; |
4359 | 270 } |
271 | |
272 static gint | |
273 close_conv_cb(GtkWidget *w, gpointer d) | |
274 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
275 GaimConversation *conv = (GaimConversation *)d; |
4359 | 276 |
277 gaim_conversation_destroy(conv); | |
4361
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
278 |
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
279 return TRUE; |
4359 | 280 } |
281 | |
7446
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
282 /* Courtesy of Galeon! */ |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
283 static void |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
284 tab_close_button_state_changed_cb(GtkWidget *widget, GtkStateType prev_state) |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
285 { |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
286 if (GTK_WIDGET_STATE(widget) == GTK_STATE_ACTIVE) |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
287 gtk_widget_set_state(widget, GTK_STATE_NORMAL); |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
288 } |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
289 |
4359 | 290 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
291 insert_image_cb(GtkWidget *save, GaimConversation *conv) |
4359 | 292 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
293 GaimGtkConversation *gtkconv; |
4359 | 294 char buf[BUF_LONG]; |
295 GtkWidget *window; | |
296 | |
297 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
298 | |
5046 | 299 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.image))) { |
7853 | 300 window = gtk_file_selection_new(_("Insert Image")); |
5046 | 301 g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S, gaim_home_dir()); |
302 gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf); | |
303 | |
7927 | 304 gtk_dialog_set_default_response(GTK_DIALOG(window), GTK_RESPONSE_OK); |
305 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(window)), | |
306 "response", G_CALLBACK(do_insert_image_cb), conv); | |
5046 | 307 |
308 gtk_widget_show(window); | |
5106 | 309 gtkconv->dialogs.image = window; |
5046 | 310 } else { |
7927 | 311 gtk_widget_destroy(gtkconv->dialogs.image); |
5106 | 312 gtkconv->dialogs.image = NULL; |
5046 | 313 } |
4359 | 314 } |
315 | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5402
diff
changeset
|
316 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
317 insert_link_cb(GtkWidget *w, GaimConversation *conv) |
4359 | 318 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
319 GaimGtkConversation *gtkconv; |
4359 | 320 |
321 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
322 | |
323 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.link))) | |
7927 | 324 dialog_link_show(conv); |
4359 | 325 else |
7927 | 326 dialog_link_destroy(conv); |
4359 | 327 |
328 gtk_widget_grab_focus(gtkconv->entry); | |
329 } | |
330 | |
331 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
332 insert_smiley_cb(GtkWidget *smiley, GaimConversation *conv) |
4359 | 333 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
334 GaimGtkConversation *gtkconv; |
4359 | 335 |
336 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
337 | |
338 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(smiley))) | |
339 show_smiley_dialog(conv, smiley); | |
340 else if (gtkconv->dialogs.smiley) | |
341 close_smiley_dialog(smiley, conv); | |
342 | |
343 gtk_widget_grab_focus(gtkconv->entry); | |
344 } | |
345 | |
346 static gboolean | |
347 entry_key_pressed_cb_1(GtkTextBuffer *buffer) | |
348 { | |
349 check_everything(buffer); | |
350 | |
351 return FALSE; | |
352 } | |
353 | |
354 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
355 send_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 356 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
357 GaimGtkConversation *gtkconv; |
7988 | 358 char *buf, *buf2; |
359 GtkTextIter start_iter, end_iter; | |
360 int limit; | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
361 GaimConnection *gc = gaim_conversation_get_gc(conv); |
4359 | 362 |
363 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7988 | 364 |
365 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_iter); | |
366 gtk_text_buffer_get_end_iter(gtkconv->entry_buffer, &end_iter); | |
367 buf2 = gtk_text_buffer_get_text(gtkconv->entry_buffer, | |
368 &start_iter, &end_iter, FALSE); | |
369 | |
370 set_toggle(gtkconv->toolbar.bold, FALSE); | |
4685 | 371 set_toggle(gtkconv->toolbar.italic, FALSE); |
372 set_toggle(gtkconv->toolbar.underline, FALSE); | |
5049 | 373 set_toggle(gtkconv->toolbar.larger_size, FALSE); |
4685 | 374 set_toggle(gtkconv->toolbar.normal_size, FALSE); |
5049 | 375 set_toggle(gtkconv->toolbar.smaller_size,FALSE); |
4685 | 376 set_toggle(gtkconv->toolbar.font, FALSE); |
377 set_toggle(gtkconv->toolbar.fgcolor, FALSE); | |
378 set_toggle(gtkconv->toolbar.bgcolor, FALSE); | |
379 set_toggle(gtkconv->toolbar.link, FALSE); | |
7988 | 380 |
4359 | 381 gtk_widget_grab_focus(gtkconv->entry); |
382 | |
7988 | 383 limit = 32 * 1024; /* This will be done again in gaim_conv_im_send. *shrug* */ |
384 | |
385 buf = g_malloc(limit); | |
386 strncpy(buf, buf2, limit); | |
387 | |
388 g_free(buf2); | |
389 | |
4359 | 390 if (strlen(buf) == 0) { |
391 g_free(buf); | |
392 | |
393 return; | |
394 } | |
395 | |
7988 | 396 buf2 = g_malloc(limit); |
397 | |
398 if (gc && gc->flags & GAIM_CONNECTION_HTML) { | |
399 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold")) { | |
400 g_snprintf(buf2, limit, "<B>%s</B>", buf); | |
401 strcpy(buf, buf2); | |
402 } | |
403 | |
404 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic")) { | |
405 g_snprintf(buf2, limit, "<I>%s</I>", buf); | |
406 strcpy(buf, buf2); | |
407 } | |
408 | |
409 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline")) { | |
410 g_snprintf(buf2, limit, "<U>%s</U>", buf); | |
411 strcpy(buf, buf2); | |
412 } | |
413 | |
414 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_strikethrough")) { | |
415 g_snprintf(buf2, limit, "<STRIKE>%s</STRIKE>", buf); | |
416 strcpy(buf, buf2); | |
417 } | |
418 | |
419 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_font") || | |
420 gtkconv->has_font) { | |
421 | |
422 g_snprintf(buf2, limit, | |
423 "<FONT FACE=\"%s\">%s</FONT>", gtkconv->fontface, buf); | |
424 strcpy(buf, buf2); | |
425 } | |
426 | |
427 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_size")) { | |
428 g_snprintf(buf2, limit, | |
429 "<FONT SIZE=\"%d\">%s</FONT>", | |
430 gaim_prefs_get_int("/gaim/gtk/conversations/font_size"), | |
431 buf); | |
432 strcpy(buf, buf2); | |
433 } | |
434 | |
435 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_fgcolor")) { | |
436 g_snprintf(buf2, limit, | |
437 "<FONT COLOR=\"#%02X%02X%02X\">%s</FONT>", | |
438 gtkconv->fg_color.red / 256, | |
439 gtkconv->fg_color.green / 256, | |
440 gtkconv->fg_color.blue / 256, buf); | |
441 strcpy(buf, buf2); | |
442 } | |
443 | |
444 if (!(gc->flags & GAIM_CONNECTION_NO_BGCOLOR) && gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_bgcolor")) { | |
445 g_snprintf(buf2, limit, | |
446 "<BODY BGCOLOR=\"#%02X%02X%02X\">%s</BODY>", | |
447 gtkconv->bg_color.red / 256, | |
448 gtkconv->bg_color.green / 256, | |
449 gtkconv->bg_color.blue / 256, buf); | |
450 strcpy(buf, buf2); | |
451 } | |
452 } | |
453 | |
454 g_free(buf2); | |
455 | |
4359 | 456 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
457 gaim_conv_im_send(GAIM_CONV_IM(conv), buf); |
7988 | 458 else |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
459 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), buf); |
4359 | 460 |
5629 | 461 if (gaim_prefs_get_bool("/gaim/gtk/conversations/im/hide_on_send")) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
462 gaim_conv_window_hide(gaim_conversation_get_window(conv)); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
463 |
4359 | 464 g_free(buf); |
465 | |
7988 | 466 gtk_text_buffer_set_text(gtkconv->entry_buffer, "", -1); |
4359 | 467 } |
468 | |
469 static void | |
7928 | 470 add_remove_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 471 { |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
472 GaimAccount *account; |
4359 | 473 const char *name; |
474 | |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
475 account = gaim_conversation_get_account(conv); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
476 name = gaim_conversation_get_name(conv); |
7879 | 477 |
478 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
7859 | 479 GaimBuddy *b; |
480 | |
481 b = gaim_find_buddy(account, name); | |
482 if (b != NULL) | |
483 show_confirm_del(b); | |
484 else if (account != NULL && gaim_account_is_connected(account)) | |
485 gaim_blist_request_add_buddy(account, (char *)name, NULL, NULL); | |
7879 | 486 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
7859 | 487 GaimChat *c; |
488 | |
489 c = gaim_blist_find_chat(account, name); | |
490 if (c != NULL) | |
491 show_confirm_del_blist_chat(c); | |
492 else if (account != NULL && gaim_account_is_connected(account)) | |
493 gaim_blist_request_add_chat(account, NULL, NULL); | |
494 } | |
4359 | 495 |
496 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
497 } | |
498 | |
7975 | 499 static void chat_do_info(GaimConversation *conv, const char *who) |
500 { | |
501 GaimPluginProtocolInfo *prpl_info = NULL; | |
502 GaimConnection *gc; | |
503 | |
504 if ((gc = gaim_conversation_get_gc(conv))) { | |
505 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | |
506 | |
507 /* | |
508 * If there are special needs for getting info on users in | |
509 * buddy chat "rooms"... | |
510 */ | |
511 if (prpl_info->get_cb_info != NULL) | |
512 prpl_info->get_cb_info(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); | |
513 else | |
514 prpl_info->get_info(gc, who); | |
515 } | |
516 } | |
517 | |
518 | |
4359 | 519 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
520 info_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 521 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
522 GaimGtkConversation *gtkconv; |
4359 | 523 |
524 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
525 | |
7879 | 526 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
527 serv_get_info(gaim_conversation_get_gc(conv), | |
528 gaim_conversation_get_name(conv)); | |
529 | |
530 gtk_widget_grab_focus(gtkconv->entry); | |
531 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
532 /* Get info of the person currently selected in the GtkTreeView */ | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
533 GaimGtkChatPane *gtkchat; |
4359 | 534 GtkTreeIter iter; |
535 GtkTreeModel *model; | |
536 GtkTreeSelection *sel; | |
537 const char *name; | |
538 | |
539 gtkchat = gtkconv->u.chat; | |
540 | |
541 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | |
542 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); | |
543 | |
544 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) | |
545 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &name, -1); | |
546 else | |
547 return; | |
548 | |
7975 | 549 chat_do_info(conv, name); |
4359 | 550 } |
551 } | |
552 | |
553 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
554 warn_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 555 { |
556 show_warn_dialog(gaim_conversation_get_gc(conv), | |
7879 | 557 gaim_conversation_get_name(conv)); |
4359 | 558 |
559 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
560 } | |
561 | |
562 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
563 block_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 564 { |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
565 GaimAccount *account; |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
566 |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
567 account = gaim_conversation_get_account(conv); |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
568 |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
569 if (account != NULL && gaim_account_is_connected(account)) |
6399
d726a36628e8
[gaim-migrate @ 6904]
Christian Hammond <chipx86@chipx86.com>
parents:
6398
diff
changeset
|
570 gaim_gtk_request_add_block(account, gaim_conversation_get_name(conv)); |
4359 | 571 |
572 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
573 } | |
574 | |
575 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
576 do_invite(GtkWidget *w, int resp, InviteBuddyInfo *info) |
4359 | 577 { |
578 const char *buddy, *message; | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
579 GaimGtkConversation *gtkconv; |
4359 | 580 |
581 gtkconv = GAIM_GTK_CONVERSATION(info->conv); | |
582 | |
583 if (resp == GTK_RESPONSE_OK) { | |
584 buddy = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(info->entry)->entry)); | |
585 message = gtk_entry_get_text(GTK_ENTRY(info->message)); | |
586 | |
4793 | 587 if (!g_ascii_strcasecmp(buddy, "")) { |
4359 | 588 g_free(info); |
589 | |
590 return; | |
591 } | |
592 | |
593 serv_chat_invite(gaim_conversation_get_gc(info->conv), | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
594 gaim_conv_chat_get_id(GAIM_CONV_CHAT(info->conv)), |
4359 | 595 message, buddy); |
596 } | |
597 | |
598 gtk_widget_destroy(invite_dialog); | |
599 invite_dialog = NULL; | |
600 | |
601 g_free(info); | |
602 } | |
603 | |
604 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
605 invite_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 606 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
607 InviteBuddyInfo *info = NULL; |
4359 | 608 |
609 if (invite_dialog == NULL) { | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
610 GaimConnection *gc; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
611 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
612 GaimGtkWindow *gtkwin; |
4359 | 613 GtkWidget *label; |
614 GtkWidget *vbox, *hbox; | |
615 GtkWidget *table; | |
616 GtkWidget *img; | |
617 | |
5024 | 618 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG); |
4359 | 619 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
620 info = g_new0(InviteBuddyInfo, 1); |
4359 | 621 info->conv = conv; |
622 | |
623 gc = gaim_conversation_get_gc(conv); | |
624 win = gaim_conversation_get_window(conv); | |
625 gtkwin = GAIM_GTK_WINDOW(win); | |
626 | |
627 /* Create the new dialog. */ | |
628 invite_dialog = gtk_dialog_new_with_buttons( | |
7859 | 629 _("Invite Buddy Into Chat Room"), |
7879 | 630 GTK_WINDOW(gtkwin->window), 0, |
631 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, | |
4359 | 632 GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); |
633 | |
634 gtk_dialog_set_default_response(GTK_DIALOG(invite_dialog), | |
635 GTK_RESPONSE_OK); | |
636 gtk_container_set_border_width(GTK_CONTAINER(invite_dialog), 6); | |
637 gtk_window_set_resizable(GTK_WINDOW(invite_dialog), FALSE); | |
638 gtk_dialog_set_has_separator(GTK_DIALOG(invite_dialog), FALSE); | |
639 | |
640 /* Setup the outside spacing. */ | |
641 vbox = GTK_DIALOG(invite_dialog)->vbox; | |
642 | |
643 gtk_box_set_spacing(GTK_BOX(vbox), 12); | |
644 gtk_container_set_border_width(GTK_CONTAINER(vbox), 6); | |
645 | |
646 /* Setup the inner hbox and put the dialog's icon in it. */ | |
647 hbox = gtk_hbox_new(FALSE, 12); | |
648 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
649 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
650 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
651 | |
652 /* Setup the right vbox. */ | |
653 vbox = gtk_vbox_new(FALSE, 0); | |
654 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
655 | |
656 /* Put our happy label in it. */ | |
657 label = gtk_label_new(_("Please enter the name of the user you wish " | |
658 "to invite, along with an optional invite " | |
659 "message.")); | |
660 gtk_widget_set_size_request(label, 350, -1); | |
661 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
662 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
663 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
664 | |
665 /* hbox for the table, and to give it some spacing on the left. */ | |
666 hbox = gtk_hbox_new(FALSE, 6); | |
667 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
668 | |
669 /* Setup the table we're going to use to lay stuff out. */ | |
670 table = gtk_table_new(2, 2, FALSE); | |
671 gtk_table_set_row_spacings(GTK_TABLE(table), 6); | |
672 gtk_table_set_col_spacings(GTK_TABLE(table), 6); | |
673 gtk_container_set_border_width(GTK_CONTAINER(table), 12); | |
674 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); | |
675 | |
676 /* Now the Buddy label */ | |
677 label = gtk_label_new(NULL); | |
678 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Buddy:")); | |
679 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
680 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); | |
681 | |
682 /* Now the Buddy drop-down entry field. */ | |
683 info->entry = gtk_combo_new(); | |
684 gtk_combo_set_case_sensitive(GTK_COMBO(info->entry), FALSE); | |
685 gtk_entry_set_activates_default( | |
686 GTK_ENTRY(GTK_COMBO(info->entry)->entry), TRUE); | |
687 | |
688 gtk_table_attach_defaults(GTK_TABLE(table), info->entry, 1, 2, 0, 1); | |
689 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->entry); | |
690 | |
691 /* Fill in the names. */ | |
692 gtk_combo_set_popdown_strings(GTK_COMBO(info->entry), | |
693 generate_invite_user_names(gc)); | |
694 | |
695 | |
696 /* Now the label for "Message" */ | |
697 label = gtk_label_new(NULL); | |
698 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Message:")); | |
699 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
700 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); | |
701 | |
702 | |
703 /* And finally, the Message entry field. */ | |
704 info->message = gtk_entry_new(); | |
705 gtk_entry_set_activates_default(GTK_ENTRY(info->message), TRUE); | |
706 | |
707 gtk_table_attach_defaults(GTK_TABLE(table), info->message, 1, 2, 1, 2); | |
708 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->message); | |
709 | |
710 /* Connect the signals. */ | |
711 g_signal_connect(G_OBJECT(invite_dialog), "response", | |
712 G_CALLBACK(do_invite), info); | |
713 } | |
714 | |
715 gtk_widget_show_all(invite_dialog); | |
716 | |
717 if (info != NULL) | |
718 gtk_widget_grab_focus(GTK_COMBO(info->entry)->entry); | |
719 } | |
720 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
721 static void |
7748 | 722 menu_new_conv_cb(gpointer data, guint action, GtkWidget *widget) |
723 { | |
724 show_im_dialog(); | |
725 } | |
726 | |
727 static void | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
728 menu_save_as_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
729 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
730 GaimConvWindow *win = (GaimConvWindow *)data; |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
731 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
732 save_convo(NULL, gaim_conv_window_get_active_conversation(win)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
733 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
734 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
735 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
736 menu_view_log_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
737 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
738 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
739 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
740 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
741 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
742 |
7431 | 743 gaim_gtk_log_show((char *)gaim_conversation_get_name(conv), gaim_conversation_get_account(conv)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
744 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
745 |
7295 | 746 struct _search { |
747 GaimGtkConversation *gtkconv; | |
748 GtkWidget *entry; | |
749 }; | |
750 | |
7929 | 751 static void do_search_cb(GtkWidget *widget, gint resp, struct _search *s) |
7295 | 752 { |
7929 | 753 switch (resp) { |
754 case GTK_RESPONSE_OK: | |
755 gtk_imhtml_search_find(GTK_IMHTML(s->gtkconv->imhtml), gtk_entry_get_text(GTK_ENTRY(s->entry))); | |
756 break; | |
757 | |
758 case GTK_RESPONSE_DELETE_EVENT: | |
759 case GTK_RESPONSE_CLOSE: | |
760 gtk_imhtml_search_clear(GTK_IMHTML(s->gtkconv->imhtml)); | |
761 gtk_widget_destroy(s->gtkconv->dialogs.search); | |
762 s->gtkconv->dialogs.search = NULL; | |
763 g_free(s); | |
764 break; | |
765 } | |
7295 | 766 } |
767 | |
768 static void | |
7751 | 769 menu_find_cb(gpointer data, guint action, GtkWidget *widget) |
7295 | 770 { |
771 GaimConvWindow *win = (GaimConvWindow *)data; | |
772 GaimConversation *conv = gaim_conv_window_get_active_conversation(win); | |
773 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); | |
774 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7929 | 775 GtkWidget *hbox; |
7295 | 776 GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG); |
7929 | 777 GtkWidget *label; |
7295 | 778 struct _search *s; |
779 | |
7798 | 780 if (gtkconv->dialogs.search) { |
781 gtk_window_present(GTK_WINDOW(gtkconv->dialogs.search)); | |
7295 | 782 return; |
7798 | 783 } |
7300
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
784 |
7295 | 785 s = g_malloc(sizeof(struct _search)); |
786 s->gtkconv = gtkconv; | |
7929 | 787 |
788 gtkconv->dialogs.search = gtk_dialog_new_with_buttons(_("Find"), | |
789 GTK_WINDOW(gtkwin->window), GTK_DIALOG_DESTROY_WITH_PARENT, | |
790 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, | |
791 GTK_STOCK_FIND, GTK_RESPONSE_OK, NULL); | |
792 gtk_dialog_set_default_response(GTK_DIALOG(gtkconv->dialogs.search), GTK_RESPONSE_OK); | |
793 g_signal_connect(G_OBJECT(gtkconv->dialogs.search), "response", | |
794 G_CALLBACK(do_search_cb), s); | |
795 | |
796 gtk_container_set_border_width(GTK_CONTAINER(gtkconv->dialogs.search), 6); | |
797 gtk_window_set_resizable(GTK_WINDOW(gtkconv->dialogs.search), FALSE); | |
798 gtk_dialog_set_has_separator(GTK_DIALOG(gtkconv->dialogs.search), FALSE); | |
799 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(gtkconv->dialogs.search)->vbox), 12); | |
800 gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(gtkconv->dialogs.search)->vbox), 6); | |
801 | |
802 hbox = gtk_hbox_new(FALSE, 12); | |
803 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(gtkconv->dialogs.search)->vbox), hbox); | |
804 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
805 | |
806 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
807 gtk_dialog_set_response_sensitive(GTK_DIALOG(gtkconv->dialogs.search), GTK_RESPONSE_OK, FALSE); | |
808 | |
809 label = gtk_label_new(NULL); | |
810 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Search for:")); | |
811 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
812 | |
813 s->entry = gtk_entry_new(); | |
814 gtk_entry_set_activates_default(GTK_ENTRY(s->entry), TRUE); | |
815 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(s->entry)); | |
816 g_signal_connect(G_OBJECT(s->entry), "changed", | |
817 G_CALLBACK(gaim_gtk_set_sensitive_if_input), | |
818 gtkconv->dialogs.search); | |
819 gtk_box_pack_start(GTK_BOX(hbox), s->entry, FALSE, FALSE, 0); | |
7300
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
820 |
7295 | 821 gtk_widget_show_all(gtkconv->dialogs.search); |
7929 | 822 gtk_widget_grab_focus(s->entry); |
7295 | 823 } |
824 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
825 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
826 menu_add_pounce_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
827 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
828 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
829 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
830 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
831 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
832 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
833 gaim_gtkpounce_dialog_show(gaim_conversation_get_account(conv), |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
834 gaim_conversation_get_name(conv), NULL); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
835 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
836 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
837 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
838 menu_insert_link_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
839 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
840 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
841 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
842 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
843 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
844 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
845 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
846 |
7927 | 847 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.link), |
848 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.link))); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
849 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
850 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
851 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
852 menu_insert_image_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
853 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
854 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
855 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
856 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
857 gtkconv = GAIM_GTK_CONVERSATION(gaim_conv_window_get_active_conversation(win)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
858 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
859 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.image), |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
860 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.image))); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
861 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
862 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
863 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
864 menu_alias_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
865 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
866 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
867 GaimConversation *conv; |
7879 | 868 GaimAccount *account; |
869 const char *name; | |
870 | |
871 conv = gaim_conv_window_get_active_conversation(win); | |
872 account = gaim_conversation_get_account(conv); | |
873 name = gaim_conversation_get_name(conv); | |
874 | |
875 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
876 GaimBuddy *b; | |
877 | |
878 b = gaim_find_buddy(account, name); | |
879 if (b != NULL) | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
880 alias_dialog_bud(b); |
7879 | 881 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
882 GaimChat *c; | |
883 | |
884 c = gaim_blist_find_chat(account, name); | |
885 if (c != NULL) | |
886 alias_dialog_blist_chat(c); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
887 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
888 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
889 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
890 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
891 menu_get_info_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
892 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
893 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
894 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
895 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
896 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
897 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
898 info_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
899 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
900 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
901 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
902 menu_invite_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
903 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
904 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
905 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
906 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
907 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
908 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
909 invite_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
910 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
911 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
912 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
913 menu_warn_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
914 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
915 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
916 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
917 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
918 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
919 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
920 warn_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
921 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
922 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
923 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
924 menu_block_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
925 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
926 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
927 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
928 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
929 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
930 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
931 block_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
932 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
933 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
934 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
935 menu_add_remove_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
936 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
937 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
938 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
939 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
940 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
941 |
7928 | 942 add_remove_cb(NULL, conv); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
943 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
944 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
945 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
946 menu_close_conv_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
947 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
948 GaimConvWindow *win = (GaimConvWindow *)data; |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
949 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
950 close_conv_cb(NULL, gaim_conv_window_get_active_conversation(win)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
951 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
952 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
953 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
954 menu_logging_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
955 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
956 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
957 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
958 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
959 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
960 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
961 if (conv == NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
962 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
963 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
964 gaim_conversation_set_logging(conv, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
965 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
966 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
967 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
968 static void |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
969 menu_toolbar_cb(gpointer data, guint action, GtkWidget *widget) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
970 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
971 GaimConvWindow *win = (GaimConvWindow *)data; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
972 GaimConversation *conv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
973 GaimGtkConversation *gtkconv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
974 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
975 conv = gaim_conv_window_get_active_conversation(win); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
976 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
977 if (conv == NULL) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
978 return; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
979 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
980 gtkconv = GAIM_GTK_CONVERSATION(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
981 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
982 gtkconv->show_formatting_toolbar = |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
983 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
984 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
985 if (gtkconv->show_formatting_toolbar) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
986 gtk_widget_show(gtkconv->toolbar.toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
987 else |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
988 gtk_widget_hide(gtkconv->toolbar.toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
989 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
990 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
991 static void |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
992 menu_sounds_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
993 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
994 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
995 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
996 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
997 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
998 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
999 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1000 if (!conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1001 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1002 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1003 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1004 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1005 gtkconv->make_sound = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1006 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1007 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1008 |
7961 | 1009 static void |
1010 chat_do_im(GaimConversation *conv, const char *who) | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1011 { |
7961 | 1012 GaimPluginProtocolInfo *prpl_info = NULL; |
1013 char *real_who; | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1014 GaimConversation *conv2; |
7961 | 1015 GaimAccount *account; |
1016 | |
1017 account = gaim_conversation_get_account(conv); | |
1018 | |
1019 if(account && account->gc) | |
1020 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl); | |
1021 | |
1022 if(prpl_info && prpl_info->get_cb_real_name) | |
1023 real_who = prpl_info->get_cb_real_name(account->gc, | |
1024 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); | |
1025 else | |
1026 real_who = g_strdup(who); | |
1027 | |
1028 if(!real_who) | |
1029 return; | |
1030 | |
1031 conv2 = gaim_find_conversation_with_account(real_who, account); | |
1032 | |
1033 if (conv2 != NULL) | |
1034 gaim_conv_window_show(gaim_conversation_get_window(conv2)); | |
1035 else | |
1036 conv2 = gaim_conversation_new(GAIM_CONV_IM, account, real_who); | |
1037 | |
1038 g_free(real_who); | |
1039 } | |
1040 | |
1041 | |
1042 static void | |
1043 chat_im_button_cb(GtkWidget *widget, GaimConversation *conv) | |
1044 { | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1045 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1046 GaimGtkChatPane *gtkchat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1047 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1048 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1049 GtkTreeSelection *sel; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1050 const char *name; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1051 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1052 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1053 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1054 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1055 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1056 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1057 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1058 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1059 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &name, -1); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1060 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1061 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1062 |
7961 | 1063 chat_do_im(conv, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1064 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1065 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1066 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1067 ignore_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1068 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1069 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1070 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1071 GaimConvChat *chat; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1072 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1073 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1074 GtkTreeSelection *sel; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1075 const char *name; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1076 int pos; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1077 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1078 chat = GAIM_CONV_CHAT(conv); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1079 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1080 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1081 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1082 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1083 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1084 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1085 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1086 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &name, -1); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1087 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1088 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1089 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1090 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1091 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1092 pos = g_list_index(gaim_conv_chat_get_users(chat), name); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1093 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1094 if (gaim_conv_chat_is_user_ignored(chat, name)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1095 gaim_conv_chat_unignore(chat, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1096 else |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1097 gaim_conv_chat_ignore(chat, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1098 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1099 add_chat_buddy_common(conv, name, pos); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1100 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1101 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1102 static void |
7398 | 1103 menu_chat_im_cb(GtkWidget *w, GaimConversation *conv) |
1104 { | |
1105 const char *who = g_object_get_data(G_OBJECT(w), "user_data"); | |
1106 | |
1107 chat_do_im(conv, who); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1108 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1109 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1110 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1111 menu_chat_info_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1112 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1113 char *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1114 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1115 who = g_object_get_data(G_OBJECT(w), "user_data"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1116 |
7975 | 1117 chat_do_info(conv, who); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1118 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1119 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1120 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1121 menu_chat_get_away_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1122 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1123 GaimPluginProtocolInfo *prpl_info = NULL; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1124 GaimConnection *gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1125 char *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1126 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1127 gc = gaim_conversation_get_gc(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1128 who = g_object_get_data(G_OBJECT(w), "user_data"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1129 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1130 if (gc != NULL) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1131 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1132 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1133 /* |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1134 * May want to expand this to work similarly to menu_info_cb? |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1135 */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1136 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1137 if (prpl_info->get_cb_away != NULL) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1138 prpl_info->get_cb_away(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1139 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1140 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1141 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1142 static void |
7928 | 1143 menu_chat_add_remove_cb(GtkWidget *w, GaimConversation *conv) |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1144 { |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1145 GaimAccount *account; |
6695 | 1146 GaimBuddy *b; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1147 char *name; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1148 |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1149 account = gaim_conversation_get_account(conv); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1150 name = g_object_get_data(G_OBJECT(w), "user_data"); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1151 b = gaim_find_buddy(account, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1152 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1153 if (b != NULL) |
5975 | 1154 show_confirm_del(b); |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1155 else if (account != NULL && gaim_account_is_connected(account)) |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1156 gaim_blist_request_add_buddy(account, name, NULL, NULL); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1157 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1158 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1159 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1160 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1161 static gint |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1162 right_click_chat_cb(GtkWidget *widget, GdkEventButton *event, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1163 GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1164 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1165 GaimPluginProtocolInfo *prpl_info = NULL; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1166 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1167 GaimGtkChatPane *gtkchat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1168 GaimConnection *gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1169 GaimAccount *account; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1170 GtkTreePath *path; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1171 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1172 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1173 GtkTreeViewColumn *column; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1174 gchar *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1175 int x, y; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1176 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1177 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1178 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1179 account = gaim_conversation_get_account(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1180 gc = account->gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1181 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1182 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1183 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1184 gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(gtkchat->list), |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1185 event->x, event->y, &path, &column, &x, &y); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1186 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1187 if (path == NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1188 return FALSE; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1189 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1190 if (gc != NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1191 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1192 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1193 gtk_tree_selection_select_path(GTK_TREE_SELECTION( |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1194 gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list))), path); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1195 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1196 gtk_tree_model_get_iter(GTK_TREE_MODEL(model), &iter, path); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1197 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &who, -1); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1198 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1199 if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) { |
7398 | 1200 chat_do_im(conv, who); |
1201 } else if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1202 static GtkWidget *menu = NULL; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1203 GtkWidget *button; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1204 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1205 /* |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1206 * If a menu already exists, destroy it before creating a new one, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1207 * thus freeing-up the memory it occupied. |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1208 */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1209 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1210 if (menu) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1211 gtk_widget_destroy(menu); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1212 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1213 menu = gtk_menu_new(); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1214 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1215 button = gtk_menu_item_new_with_label(_("IM")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1216 g_signal_connect(G_OBJECT(button), "activate", |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1217 G_CALLBACK(menu_chat_im_cb), conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1218 g_object_set_data(G_OBJECT(button), "user_data", who); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1219 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1220 gtk_widget_show(button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1221 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1222 if (gaim_conv_chat_is_user_ignored(GAIM_CONV_CHAT(conv), who)) |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1223 button = gtk_menu_item_new_with_label(_("Un-Ignore")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1224 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1225 button = gtk_menu_item_new_with_label(_("Ignore")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1226 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1227 g_signal_connect(G_OBJECT(button), "activate", |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1228 G_CALLBACK(ignore_cb), conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1229 g_object_set_data(G_OBJECT(button), "user_data", who); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1230 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1231 gtk_widget_show(button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1232 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1233 if (gc && prpl_info->get_info) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1234 button = gtk_menu_item_new_with_label(_("Info")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1235 g_signal_connect(G_OBJECT(button), "activate", |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1236 G_CALLBACK(menu_chat_info_cb), conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1237 g_object_set_data(G_OBJECT(button), "user_data", who); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1238 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1239 gtk_widget_show(button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1240 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1241 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1242 if (gc && prpl_info->get_cb_away) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1243 button = gtk_menu_item_new_with_label(_("Get Away Msg")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1244 g_signal_connect(G_OBJECT(button), "activate", |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1245 G_CALLBACK(menu_chat_get_away_cb), conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1246 g_object_set_data(G_OBJECT(button), "user_data", who); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1247 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1248 gtk_widget_show(button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1249 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1250 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1251 /* Added by Jonas <jonas@birme.se> */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1252 if (gc) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1253 if (gaim_find_buddy(gc->account, who)) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1254 button = gtk_menu_item_new_with_label(_("Remove")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1255 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1256 button = gtk_menu_item_new_with_label(_("Add")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1257 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1258 g_signal_connect(G_OBJECT(button), "activate", |
7928 | 1259 G_CALLBACK(menu_chat_add_remove_cb), conv); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1260 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1261 g_object_set_data(G_OBJECT(button), "user_data", who); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1262 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1263 gtk_widget_show(button); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1264 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1265 /* End Jonas */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1266 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1267 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1268 event->button, event->time); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1269 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1270 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1271 return TRUE; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1272 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1273 |
4359 | 1274 static gboolean |
1275 entry_key_pressed_cb_2(GtkWidget *entry, GdkEventKey *event, gpointer data) | |
1276 { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1277 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1278 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1279 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1280 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1281 |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1282 conv = (GaimConversation *)data; |
4359 | 1283 gtkconv = GAIM_GTK_CONVERSATION(conv); |
1284 win = gaim_conversation_get_window(conv); | |
4362 | 1285 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 1286 |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
1287 if (event->keyval == GDK_Page_Up) { |
4359 | 1288 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); |
1289 | |
1290 if (!(event->state & GDK_CONTROL_MASK)) | |
1291 gtk_imhtml_page_up(GTK_IMHTML(gtkconv->imhtml)); | |
1292 } | |
1293 else if (event->keyval == GDK_Page_Down) { | |
1294 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1295 | |
1296 if (!(event->state & GDK_CONTROL_MASK)) | |
1297 gtk_imhtml_page_down(GTK_IMHTML(gtkconv->imhtml)); | |
1298 } | |
6033 | 1299 else if (event->keyval == GDK_F2) { |
1300 | |
1301 gaim_prefs_set_bool("/gaim/gtk/conversations/show_timestamps", | |
1302 !gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); | |
4359 | 1303 } |
1304 else if (event->keyval == GDK_Return || event->keyval == GDK_KP_Enter) { | |
1305 if ((event->state & GDK_CONTROL_MASK) && | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1306 gaim_prefs_get_bool("/gaim/gtk/conversations/ctrl_enter_sends")) { |
4359 | 1307 |
1308 send_cb(NULL, conv); | |
1309 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1310 | |
1311 return TRUE; | |
1312 } | |
1313 else if (!(event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK)) && | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1314 gaim_prefs_get_bool("/gaim/gtk/conversations/enter_sends")) { |
4359 | 1315 |
1316 send_cb(NULL, conv); | |
1317 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1318 | |
1319 return TRUE; | |
1320 } | |
1321 | |
1322 return FALSE; | |
1323 } | |
6014 | 1324 else if ((event->state & GDK_CONTROL_MASK) && (event->keyval == 'm' || |
1325 event->keyval == 'M')) { | |
4359 | 1326 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); |
1327 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, "\n", 1); | |
1328 } | |
1329 else if (event->state & GDK_CONTROL_MASK) { | |
1330 switch (event->keyval) { | |
1331 case GDK_Up: | |
1332 if (!conv->send_history) | |
1333 break; | |
1334 | |
1335 if (!conv->send_history->prev) { | |
1336 GtkTextIter start, end; | |
1337 | |
1338 if (conv->send_history->data) | |
1339 g_free(conv->send_history->data); | |
1340 | |
1341 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, | |
1342 &start); | |
1343 gtk_text_buffer_get_end_iter(gtkconv->entry_buffer, &end); | |
1344 | |
1345 conv->send_history->data = | |
1346 gtk_text_buffer_get_text(gtkconv->entry_buffer, | |
1347 &start, &end, FALSE); | |
1348 } | |
1349 | |
1350 if (conv->send_history->next && | |
1351 conv->send_history->next->data) { | |
1352 | |
1353 conv->send_history = conv->send_history->next; | |
7988 | 1354 gtk_text_buffer_set_text(gtkconv->entry_buffer, |
1355 conv->send_history->data, -1); | |
4359 | 1356 } |
1357 | |
1358 break; | |
1359 | |
1360 case GDK_Down: | |
1361 if (!conv->send_history) | |
1362 break; | |
1363 | |
1364 if (conv->send_history->prev) { | |
1365 conv->send_history = conv->send_history->prev; | |
1366 | |
7988 | 1367 if (conv->send_history->data) |
1368 gtk_text_buffer_set_text(gtkconv->entry_buffer, | |
1369 conv->send_history->data, -1); | |
4359 | 1370 } |
1371 | |
1372 break; | |
1373 } | |
1374 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1375 if (gaim_prefs_get_bool("/gaim/gtk/conversations/html_shortcuts")) { |
4359 | 1376 switch (event->keyval) { |
1377 case 'i': | |
1378 case 'I': | |
4685 | 1379 set_toggle(gtkconv->toolbar.italic, |
4359 | 1380 !gtk_toggle_button_get_active( |
1381 GTK_TOGGLE_BUTTON(gtkconv->toolbar.italic))); | |
1382 | |
1383 g_signal_stop_emission_by_name(G_OBJECT(entry), | |
1384 "key_press_event"); | |
1385 break; | |
1386 | |
1387 case 'u': /* ctrl-u is GDK_Clear, which clears the line. */ | |
1388 case 'U': | |
4685 | 1389 set_toggle(gtkconv->toolbar.underline, |
4359 | 1390 !gtk_toggle_button_get_active( |
1391 GTK_TOGGLE_BUTTON(gtkconv->toolbar.underline))); | |
1392 | |
1393 g_signal_stop_emission_by_name(G_OBJECT(entry), | |
1394 "key_press_event"); | |
1395 break; | |
1396 | |
1397 case 'b': /* ctrl-b is GDK_Left, which moves backwards. */ | |
1398 case 'B': | |
4685 | 1399 set_toggle(gtkconv->toolbar.bold, |
4359 | 1400 !gtk_toggle_button_get_active( |
1401 GTK_TOGGLE_BUTTON(gtkconv->toolbar.bold))); | |
1402 | |
1403 g_signal_stop_emission_by_name(G_OBJECT(entry), | |
1404 "key_press_event"); | |
1405 break; | |
6014 | 1406 |
4359 | 1407 case '-': |
6015 | 1408 set_toggle(gtkconv->toolbar.smaller_size, |
1409 !gtk_toggle_button_get_active( | |
1410 GTK_TOGGLE_BUTTON(gtkconv->toolbar.smaller_size))); | |
6014 | 1411 |
4359 | 1412 g_signal_stop_emission_by_name(G_OBJECT(entry), |
1413 "key_press_event"); | |
1414 break; | |
1415 | |
1416 case '=': | |
1417 case '+': | |
6015 | 1418 set_toggle(gtkconv->toolbar.larger_size, |
1419 !gtk_toggle_button_get_active( | |
1420 GTK_TOGGLE_BUTTON(gtkconv->toolbar.larger_size))); | |
4359 | 1421 |
1422 g_signal_stop_emission_by_name(G_OBJECT(entry), | |
1423 "key_press_event"); | |
1424 break; | |
1425 | |
1426 case '0': | |
7740 | 1427 /*set_toggle(gtkconv->toolbar.normal_size, |
4685 | 1428 !gtk_toggle_button_get_active( |
1429 GTK_TOGGLE_BUTTON(gtkconv->toolbar.normal_size))); | |
4359 | 1430 |
1431 g_signal_stop_emission_by_name(G_OBJECT(entry), | |
7740 | 1432 "key_press_event"); */ |
4359 | 1433 break; |
1434 | |
1435 case 'f': | |
1436 case 'F': | |
4685 | 1437 set_toggle(gtkconv->toolbar.font, |
4359 | 1438 !gtk_toggle_button_get_active( |
4685 | 1439 GTK_TOGGLE_BUTTON(gtkconv->toolbar.font))); |
4359 | 1440 |
1441 g_signal_stop_emission_by_name(G_OBJECT(entry), | |
1442 "key_press_event"); | |
1443 break; | |
1444 } | |
1445 } | |
1446 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1447 if (gaim_prefs_get_bool("/gaim/gtk/conversations/smiley_shortcuts")) { |
4359 | 1448 char buf[7]; |
1449 | |
1450 *buf = '\0'; | |
1451 | |
1452 switch (event->keyval) { | |
1453 case '1': strcpy(buf, ":-)"); break; | |
1454 case '2': strcpy(buf, ":-("); break; | |
1455 case '3': strcpy(buf, ";-)"); break; | |
1456 case '4': strcpy(buf, ":-P"); break; | |
1457 case '5': strcpy(buf, "=-O"); break; | |
1458 case '6': strcpy(buf, ":-*"); break; | |
1459 case '7': strcpy(buf, ">:o"); break; | |
1460 case '8': strcpy(buf, "8-)"); break; | |
1461 case '!': strcpy(buf, ":-$"); break; | |
1462 case '@': strcpy(buf, ":-!"); break; | |
1463 case '#': strcpy(buf, ":-["); break; | |
1464 case '$': strcpy(buf, "O:-)"); break; | |
1465 case '%': strcpy(buf, ":-/"); break; | |
1466 case '^': strcpy(buf, ":'("); break; | |
1467 case '&': strcpy(buf, ":-X"); break; | |
1468 case '*': strcpy(buf, ":-D"); break; | |
1469 default: break; | |
1470 } | |
1471 | |
1472 if (*buf) { | |
1473 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, | |
1474 buf, -1); | |
1475 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1476 } | |
1477 } | |
1478 | |
1479 if (event->keyval == 'l') { | |
1480 gtk_imhtml_clear(GTK_IMHTML(gtkconv->imhtml)); | |
1481 g_string_free(conv->history, TRUE); | |
1482 conv->history = g_string_new(""); | |
1483 } | |
1484 else if (event->keyval == 'z') { | |
1485 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
5133 | 1486 |
1487 gtk_window_iconify(GTK_WINDOW(gtkwin->window)); | |
4359 | 1488 } |
1489 else if (event->keyval == '[') { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1490 gaim_conv_window_switch_conversation(win, |
4359 | 1491 gaim_conversation_get_index(conv) - 1); |
1492 | |
1493 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1494 } | |
1495 else if (event->keyval == ']') { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1496 gaim_conv_window_switch_conversation(win, |
4359 | 1497 gaim_conversation_get_index(conv) + 1); |
1498 | |
1499 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1500 } | |
1501 else if (event->keyval == GDK_Tab) { | |
1502 move_next_tab(conv); | |
1503 | |
1504 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1505 | |
1506 return TRUE; | |
1507 } | |
1508 } | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1509 else if (event->keyval == GDK_Tab && |
4359 | 1510 gaim_conversation_get_type(conv) == GAIM_CONV_CHAT && |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1511 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/tab_completion")) { |
4359 | 1512 |
1513 tab_complete(conv); | |
1514 | |
1515 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1516 | |
1517 return TRUE; | |
1518 } | |
1519 else if ((event->state & GDK_MOD1_MASK) && | |
1520 event->keyval > '0' && event->keyval <= '9') { | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1521 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1522 gaim_conv_window_switch_conversation(win, event->keyval - '1'); |
4359 | 1523 |
1524 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); | |
1525 } | |
1526 | |
1527 return FALSE; | |
1528 } | |
1529 | |
1530 /* | |
1531 * NOTE: | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1532 * This guy just kills a single right click from being propagated any |
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1533 * further. I have no idea *why* we need this, but we do ... It |
4359 | 1534 * prevents right clicks on the GtkTextView in a convo dialog from |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1535 * going all the way down to the notebook. I suspect a bug in |
4359 | 1536 * GtkTextView, but I'm not ready to point any fingers yet. |
1537 */ | |
1538 static gboolean | |
1539 entry_stop_rclick_cb(GtkWidget *widget, GdkEventButton *event, gpointer data) | |
1540 { | |
1541 if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { | |
1542 /* Right single click */ | |
1543 g_signal_stop_emission_by_name(G_OBJECT(widget), "button_press_event"); | |
1544 | |
1545 return TRUE; | |
1546 } | |
1547 | |
1548 return FALSE; | |
1549 } | |
1550 | |
6057 | 1551 static gboolean |
1552 refocus_entry_cb(GtkWidget *widget, GdkEventButton *event, gpointer data) | |
1553 { | |
1554 GaimGtkConversation *gtkconv = data; | |
1555 | |
1556 gtk_widget_grab_focus(gtkconv->entry); | |
1557 | |
1558 return FALSE; | |
1559 } | |
1560 | |
4359 | 1561 static void |
4673 | 1562 menu_conv_sel_send_cb(GObject *m, gpointer data) |
4359 | 1563 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1564 GaimConvWindow *win = g_object_get_data(m, "user_data"); |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
1565 GaimAccount *account = g_object_get_data(m, "gaim_account"); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1566 GaimConversation *conv; |
4359 | 1567 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1568 conv = gaim_conv_window_get_active_conversation(win); |
4359 | 1569 |
4491 | 1570 gaim_conversation_set_account(conv, account); |
4359 | 1571 } |
1572 | |
1573 static void | |
1574 insert_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *position, | |
1575 gchar *new_text, gint new_text_length, gpointer user_data) | |
1576 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1577 GaimConversation *conv = (GaimConversation *)user_data; |
4359 | 1578 |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1579 g_return_if_fail(conv != NULL); |
4359 | 1580 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1581 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) |
4359 | 1582 return; |
1583 | |
1584 got_typing_keypress(conv, (gtk_text_iter_is_start(position) && | |
1585 gtk_text_iter_is_end(position))); | |
1586 } | |
1587 | |
1588 static void | |
1589 delete_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *start_pos, | |
1590 GtkTextIter *end_pos, gpointer user_data) | |
1591 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1592 GaimConversation *conv = (GaimConversation *)user_data; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1593 GaimConvIm *im; |
4359 | 1594 |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1595 g_return_if_fail(conv != NULL); |
4359 | 1596 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1597 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) |
4359 | 1598 return; |
1599 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1600 im = GAIM_CONV_IM(conv); |
4359 | 1601 |
1602 if (gtk_text_iter_is_start(start_pos) && gtk_text_iter_is_end(end_pos)) { | |
1603 | |
1604 /* We deleted all the text, so turn off typing. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1605 if (gaim_conv_im_get_type_again_timeout(im)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1606 gaim_conv_im_stop_type_again_timeout(im); |
4359 | 1607 |
1608 serv_send_typing(gaim_conversation_get_gc(conv), | |
6695 | 1609 gaim_conversation_get_name(conv), |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
1610 GAIM_NOT_TYPING); |
4359 | 1611 } |
1612 else { | |
1613 /* We're deleting, but not all of it, so it counts as typing. */ | |
1614 got_typing_keypress(conv, FALSE); | |
1615 } | |
1616 } | |
1617 | |
1618 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1619 notebook_init_grab(GaimGtkWindow *gtkwin, GtkWidget *widget) |
4359 | 1620 { |
1621 static GdkCursor *cursor = NULL; | |
1622 | |
1623 gtkwin->in_drag = TRUE; | |
1624 | |
1625 if (gtkwin->drag_leave_signal) { | |
1626 g_signal_handler_disconnect(G_OBJECT(widget), | |
1627 gtkwin->drag_leave_signal); | |
1628 | |
1629 gtkwin->drag_leave_signal = 0; | |
1630 } | |
1631 | |
1632 if (cursor == NULL) | |
1633 cursor = gdk_cursor_new(GDK_FLEUR); | |
1634 | |
1635 /* Grab the pointer */ | |
1636 gtk_grab_add(gtkwin->notebook); | |
5114
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1637 #ifndef _WIN32 |
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1638 /* Currently for win32 GTK+ (as of 2.2.1), gdk_pointer_is_grabbed will |
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1639 always be true after a button press. */ |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1640 if (!gdk_pointer_is_grabbed()) |
5114
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1641 #endif |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1642 gdk_pointer_grab(gtkwin->notebook->window, FALSE, |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1643 GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1644 NULL, cursor, GDK_CURRENT_TIME); |
4359 | 1645 } |
1646 | |
1647 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1648 notebook_motion_cb(GtkWidget *widget, GdkEventButton *e, GaimConvWindow *win) |
4359 | 1649 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1650 GaimGtkWindow *gtkwin; |
4359 | 1651 |
1652 gtkwin = GAIM_GTK_WINDOW(win); | |
1653 | |
1654 /* | |
1655 * Make sure the user moved the mouse far enough for the | |
1656 * drag to be initiated. | |
1657 */ | |
1658 if (gtkwin->in_predrag) { | |
1659 if (e->x_root < gtkwin->drag_min_x || | |
1660 e->x_root >= gtkwin->drag_max_x || | |
1661 e->y_root < gtkwin->drag_min_y || | |
1662 e->y_root >= gtkwin->drag_max_y) { | |
1663 | |
1664 gtkwin->in_predrag = FALSE; | |
1665 notebook_init_grab(gtkwin, widget); | |
1666 } | |
1667 } | |
1668 else { /* Otherwise, draw the arrows. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1669 GaimConvWindow *dest_win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1670 GaimGtkWindow *dest_gtkwin; |
4359 | 1671 GtkNotebook *dest_notebook; |
1672 GtkWidget *tab, *last_vis_tab = NULL; | |
1673 gint nb_x, nb_y, page_num, i, last_vis_tab_loc = -1; | |
1674 gint arrow1_x, arrow1_y, arrow2_x, arrow2_y; | |
1675 gboolean horiz_tabs = FALSE, tab_found = FALSE; | |
1676 GList *l; | |
1677 | |
1678 /* Get the window that the cursor is over. */ | |
1679 dest_win = gaim_gtkwin_get_at_xy(e->x_root, e->y_root); | |
1680 | |
1681 if (dest_win == NULL) { | |
1682 dnd_hints_hide_all(); | |
1683 | |
1684 return TRUE; | |
1685 } | |
1686 | |
1687 dest_gtkwin = GAIM_GTK_WINDOW(dest_win); | |
1688 | |
1689 dest_notebook = GTK_NOTEBOOK(dest_gtkwin->notebook); | |
1690 | |
1691 gdk_window_get_origin(GTK_WIDGET(dest_notebook)->window, &nb_x, &nb_y); | |
1692 | |
1693 arrow1_x = arrow2_x = nb_x; | |
1694 arrow1_y = arrow2_y = nb_y; | |
1695 | |
1696 page_num = gaim_gtkconv_get_dest_tab_at_xy(dest_win, | |
1697 e->x_root, e->y_root); | |
1698 | |
1699 if (gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_TOP || | |
1700 gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_BOTTOM) { | |
1701 | |
1702 horiz_tabs = TRUE; | |
1703 } | |
1704 | |
1705 /* Find out where to put the arrows. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1706 for (l = gaim_conv_window_get_conversations(dest_win), i = 0; |
4359 | 1707 l != NULL; |
1708 l = l->next, i++) { | |
1709 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1710 GaimConversation *conv = l->data; |
4359 | 1711 |
1712 tab = GAIM_GTK_CONVERSATION(conv)->tabby; | |
1713 | |
1714 /* | |
1715 * If this is the correct tab, record the positions | |
1716 * for the arrows. | |
1717 */ | |
1718 if (i == page_num) { | |
1719 if (horiz_tabs) { | |
1720 arrow1_x = arrow2_x = nb_x + tab->allocation.x; | |
1721 arrow1_y = nb_y + tab->allocation.y; | |
1722 arrow2_y = nb_y + tab->allocation.y + | |
1723 tab->allocation.height; | |
1724 } | |
1725 else { | |
1726 arrow1_x = nb_x + tab->allocation.x; | |
1727 arrow2_x = nb_x + tab->allocation.x + | |
1728 tab->allocation.width; | |
1729 arrow1_y = arrow2_y = nb_y + tab->allocation.y; | |
1730 } | |
1731 | |
1732 tab_found = TRUE; | |
1733 break; | |
1734 } | |
1735 else { /* Keep track of the right-most tab that we see. */ | |
1736 if (horiz_tabs && tab->allocation.x > last_vis_tab_loc) { | |
1737 last_vis_tab = tab; | |
1738 last_vis_tab_loc = tab->allocation.x; | |
1739 } | |
1740 else if (!horiz_tabs && tab->allocation.y > last_vis_tab_loc) { | |
1741 last_vis_tab = tab; | |
1742 last_vis_tab_loc = tab->allocation.y; | |
1743 } | |
1744 } | |
1745 } | |
1746 | |
1747 /* | |
1748 * If we didn't find the tab, then we'll just place the | |
1749 * arrows to the right/bottom of the last visible tab. | |
1750 */ | |
1751 if (!tab_found && last_vis_tab) { | |
1752 if (horiz_tabs) { | |
1753 arrow1_x = arrow2_x = nb_x + last_vis_tab->allocation.x + | |
1754 last_vis_tab->allocation.width; | |
1755 arrow1_y = nb_y + last_vis_tab->allocation.y; | |
1756 arrow2_y = nb_y + last_vis_tab->allocation.y + | |
1757 last_vis_tab->allocation.height; | |
1758 } | |
1759 else { | |
1760 arrow1_x = nb_x + last_vis_tab->allocation.x; | |
1761 arrow2_x = nb_x + last_vis_tab->allocation.x + | |
1762 last_vis_tab->allocation.width; | |
1763 arrow1_y = arrow2_y = nb_y + last_vis_tab->allocation.y + | |
1764 last_vis_tab->allocation.height; | |
1765 } | |
1766 } | |
1767 | |
1768 if (horiz_tabs) { | |
1769 dnd_hints_show(HINT_ARROW_DOWN, arrow1_x, arrow1_y); | |
1770 dnd_hints_show(HINT_ARROW_UP, arrow2_x, arrow2_y); | |
1771 } | |
1772 else { | |
1773 dnd_hints_show(HINT_ARROW_RIGHT, arrow1_x, arrow1_y); | |
1774 dnd_hints_show(HINT_ARROW_LEFT, arrow2_x, arrow2_y); | |
1775 } | |
1776 } | |
1777 | |
1778 return TRUE; | |
1779 } | |
1780 | |
1781 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1782 notebook_leave_cb(GtkWidget *widget, GdkEventCrossing *e, GaimConvWindow *win) |
4359 | 1783 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1784 GaimGtkWindow *gtkwin; |
4359 | 1785 |
1786 gtkwin = GAIM_GTK_WINDOW(win); | |
1787 | |
1788 if (gtkwin->in_drag) | |
1789 return FALSE; | |
1790 | |
1791 if (e->x_root < gtkwin->drag_min_x || | |
1792 e->x_root >= gtkwin->drag_max_x || | |
1793 e->y_root < gtkwin->drag_min_y || | |
1794 e->y_root >= gtkwin->drag_max_y) { | |
1795 | |
1796 gtkwin->in_predrag = FALSE; | |
1797 notebook_init_grab(gtkwin, widget); | |
1798 } | |
1799 | |
1800 return TRUE; | |
1801 } | |
1802 | |
1803 /* | |
1804 * THANK YOU GALEON! | |
1805 */ | |
1806 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1807 notebook_press_cb(GtkWidget *widget, GdkEventButton *e, GaimConvWindow *win) |
4359 | 1808 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1809 GaimGtkWindow *gtkwin; |
4359 | 1810 gint nb_x, nb_y, x_rel, y_rel; |
1811 GList *l; | |
1812 int tab_clicked; | |
1813 | |
1814 if (e->button != 1 || e->type != GDK_BUTTON_PRESS) | |
1815 return FALSE; | |
1816 | |
1817 gtkwin = GAIM_GTK_WINDOW(win); | |
1818 | |
1819 if (gtkwin->in_drag) { | |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1820 gaim_debug(GAIM_DEBUG_WARNING, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1821 "Already in the middle of a window drag at tab_press_cb\n"); |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1822 return TRUE; |
4359 | 1823 } |
1824 | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1825 /* |
4359 | 1826 * Make sure a tab was actually clicked. The arrow buttons |
1827 * mess things up. | |
1828 */ | |
1829 tab_clicked = gaim_gtkconv_get_tab_at_xy(win, e->x_root, e->y_root); | |
1830 | |
1831 if (tab_clicked == -1) | |
1832 return FALSE; | |
1833 | |
1834 /* | |
1835 * Get the relative position of the press event, with regards to | |
1836 * the position of the notebook. | |
1837 */ | |
1838 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
1839 | |
1840 x_rel = e->x_root - nb_x; | |
1841 y_rel = e->y_root - nb_y; | |
1842 | |
1843 /* Reset the min/max x/y */ | |
1844 gtkwin->drag_min_x = 0; | |
1845 gtkwin->drag_min_y = 0; | |
1846 gtkwin->drag_max_x = 0; | |
1847 gtkwin->drag_max_y = 0; | |
1848 | |
1849 /* Find out which tab was dragged. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1850 for (l = gaim_conv_window_get_conversations(win); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1851 GaimConversation *conv = l->data; |
4359 | 1852 GtkWidget *tab = GAIM_GTK_CONVERSATION(conv)->tabby; |
1853 | |
1854 if (!GTK_WIDGET_VISIBLE(tab)) | |
1855 continue; | |
1856 | |
1857 if (tab->allocation.x > x_rel || tab->allocation.y > y_rel) | |
1858 break; | |
1859 | |
1860 /* Save the borders of the tab. */ | |
1861 gtkwin->drag_min_x = tab->allocation.x + nb_x; | |
1862 gtkwin->drag_min_y = tab->allocation.y + nb_y; | |
1863 gtkwin->drag_max_x = tab->allocation.width + gtkwin->drag_min_x; | |
1864 gtkwin->drag_max_y = tab->allocation.height + gtkwin->drag_min_y; | |
1865 } | |
1866 | |
1867 /* Make sure the click occurred in the tab. */ | |
1868 if (e->x_root < gtkwin->drag_min_x || | |
1869 e->x_root >= gtkwin->drag_max_x || | |
1870 e->y_root < gtkwin->drag_min_y || | |
1871 e->y_root >= gtkwin->drag_max_y) { | |
1872 | |
1873 return FALSE; | |
1874 } | |
1875 | |
1876 gtkwin->in_predrag = TRUE; | |
1877 | |
1878 /* Connect the new motion signals. */ | |
1879 gtkwin->drag_motion_signal = | |
1880 g_signal_connect(G_OBJECT(widget), "motion_notify_event", | |
1881 G_CALLBACK(notebook_motion_cb), win); | |
1882 | |
1883 gtkwin->drag_leave_signal = | |
1884 g_signal_connect(G_OBJECT(widget), "leave_notify_event", | |
1885 G_CALLBACK(notebook_leave_cb), win); | |
1886 | |
1887 return FALSE; | |
1888 } | |
1889 | |
1890 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1891 notebook_release_cb(GtkWidget *widget, GdkEventButton *e, GaimConvWindow *win) |
4359 | 1892 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1893 GaimConvWindow *dest_win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1894 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1895 GaimGtkWindow *dest_gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1896 GaimConversation *conv; |
4359 | 1897 GtkNotebook *dest_notebook; |
1898 gint dest_page_num; | |
1899 | |
1900 /* | |
1901 * Don't check to make sure that the event's window matches the | |
1902 * widget's, because we may be getting an event passed on from the | |
1903 * close button. | |
1904 */ | |
1905 if (e->button != 1 && e->type != GDK_BUTTON_RELEASE) | |
1906 return FALSE; | |
1907 | |
1908 if (gdk_pointer_is_grabbed()) { | |
1909 gdk_pointer_ungrab(GDK_CURRENT_TIME); | |
1910 gtk_grab_remove(widget); | |
1911 } | |
1912 | |
1913 gtkwin = GAIM_GTK_WINDOW(win); | |
1914 | |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1915 if (!gtkwin->in_predrag && !gtkwin->in_drag) |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1916 return FALSE; |
4359 | 1917 |
1918 /* Disconnect the motion signal. */ | |
1919 if (gtkwin->drag_motion_signal) { | |
1920 g_signal_handler_disconnect(G_OBJECT(widget), | |
1921 gtkwin->drag_motion_signal); | |
1922 | |
1923 gtkwin->drag_motion_signal = 0; | |
1924 } | |
1925 | |
1926 /* | |
1927 * If we're in a pre-drag, we'll also need to disconnect the leave | |
1928 * signal. | |
1929 */ | |
1930 if (gtkwin->in_predrag) { | |
1931 gtkwin->in_predrag = FALSE; | |
1932 | |
1933 if (gtkwin->drag_leave_signal) { | |
1934 g_signal_handler_disconnect(G_OBJECT(widget), | |
1935 gtkwin->drag_leave_signal); | |
1936 | |
1937 gtkwin->drag_leave_signal = 0; | |
1938 } | |
1939 } | |
1940 | |
1941 /* If we're not in drag... */ | |
1942 /* We're perfectly normal people! */ | |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1943 if (!gtkwin->in_drag) |
4359 | 1944 return FALSE; |
1945 | |
1946 gtkwin->in_drag = FALSE; | |
1947 | |
1948 dnd_hints_hide_all(); | |
1949 | |
4369
7e1fb422e5fd
[gaim-migrate @ 4635]
Christian Hammond <chipx86@chipx86.com>
parents:
4368
diff
changeset
|
1950 dest_win = gaim_gtkwin_get_at_xy(e->x_root, e->y_root); |
4359 | 1951 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1952 conv = gaim_conv_window_get_active_conversation(win); |
4359 | 1953 |
1954 if (dest_win == NULL) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1955 if (gaim_conv_window_get_conversation_count(win) < 2) |
4359 | 1956 return FALSE; |
1957 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1958 if (gaim_conv_window_get_conversation_count(win) > 1) { |
4359 | 1959 /* Make a new window to stick this to. */ |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1960 GaimConvWindow *new_win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1961 GaimGtkWindow *new_gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1962 GaimGtkConversation *gtkconv; |
4748
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1963 gint win_width, win_height; |
5121 | 1964 |
1965 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4359 | 1966 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1967 new_win = gaim_conv_window_new(); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1968 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1969 gaim_conv_window_add_conversation(new_win, |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1970 gaim_conv_window_remove_conversation(win, |
5139
d0182ae31ab8
[gaim-migrate @ 5503]
Christian Hammond <chipx86@chipx86.com>
parents:
5133
diff
changeset
|
1971 gaim_conversation_get_index(conv))); |
5121 | 1972 |
4748
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1973 new_gtkwin = GAIM_GTK_WINDOW(new_win); |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1974 |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1975 gtk_window_get_size(GTK_WINDOW(new_gtkwin->window), |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1976 &win_width, &win_height); |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1977 |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1978 gtk_window_move(GTK_WINDOW(new_gtkwin->window), |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1979 e->x_root - (win_width / 2), |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1980 e->y_root - (win_height / 2)); |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
1981 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1982 gaim_conv_window_show(new_win); |
4359 | 1983 } |
1984 | |
1985 return TRUE; | |
1986 } | |
1987 | |
4369
7e1fb422e5fd
[gaim-migrate @ 4635]
Christian Hammond <chipx86@chipx86.com>
parents:
4368
diff
changeset
|
1988 dest_gtkwin = GAIM_GTK_WINDOW(dest_win); |
7e1fb422e5fd
[gaim-migrate @ 4635]
Christian Hammond <chipx86@chipx86.com>
parents:
4368
diff
changeset
|
1989 |
4359 | 1990 /* Get the destination notebook. */ |
1991 dest_notebook = GTK_NOTEBOOK(gtkwin->notebook); | |
1992 | |
1993 /* Get the destination page number. */ | |
1994 dest_page_num = gaim_gtkconv_get_dest_tab_at_xy(dest_win, | |
7143 | 1995 e->x_root, e->y_root); |
4359 | 1996 |
1997 if (win == dest_win) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1998 gaim_conv_window_move_conversation(win, |
4359 | 1999 gaim_conversation_get_index(conv), dest_page_num); |
2000 } | |
2001 else { | |
2002 size_t pos; | |
2003 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2004 gaim_conv_window_remove_conversation(win, |
4359 | 2005 gaim_conversation_get_index(conv)); |
2006 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2007 pos = gaim_conv_window_add_conversation(dest_win, conv); |
4359 | 2008 |
5901
74e273e22f94
[gaim-migrate @ 6333]
Christian Hammond <chipx86@chipx86.com>
parents:
5881
diff
changeset
|
2009 if (pos != dest_page_num) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2010 gaim_conv_window_move_conversation(dest_win, pos, dest_page_num); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2011 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2012 gaim_conv_window_switch_conversation(dest_win, dest_page_num); |
4359 | 2013 } |
2014 | |
2015 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
2016 | |
2017 return TRUE; | |
2018 } | |
2019 | |
7143 | 2020 static GdkPixbuf *get_tab_icon(GaimConversation *conv) |
2021 { | |
2022 GaimAccount *account = gaim_conversation_get_account(conv); | |
2023 const char *name = gaim_conversation_get_name(conv); | |
2024 GdkPixbuf *status = NULL; | |
2025 | |
2026 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
2027 GaimBuddy *b = gaim_find_buddy(account, name); | |
2028 if (b != NULL) { | |
2029 status = gaim_gtk_blist_get_status_icon((GaimBlistNode*)b, | |
2030 GAIM_STATUS_ICON_SMALL); | |
2031 } | |
2032 } | |
2033 | |
2034 if (!status) { | |
2035 GdkPixbuf *pixbuf; | |
2036 pixbuf = create_prpl_icon(account); | |
2037 | |
2038 if (pixbuf) { | |
2039 status = gdk_pixbuf_scale_simple(pixbuf, 15, 15, | |
2040 GDK_INTERP_BILINEAR); | |
2041 g_object_unref(pixbuf); | |
2042 } | |
2043 } | |
2044 return status; | |
2045 } | |
2046 | |
7887 | 2047 /* |
2048 * Makes sure all the menu items and all the buttons are hidden/shown and | |
2049 * sensitive/insensitve. This is called after changing tabs and when an | |
2050 * account signs on or off. | |
2051 */ | |
4359 | 2052 static void |
7887 | 2053 gray_stuff_out(GaimConversation *conv) |
4359 | 2054 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2055 GaimConvWindow *win; |
7887 | 2056 GaimGtkWindow *gtkwin; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2057 GaimGtkConversation *gtkconv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2058 GaimConnection *gc; |
7887 | 2059 GaimPluginProtocolInfo *prpl_info = NULL; |
7222 | 2060 GdkPixbuf *window_icon = NULL; |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2061 |
7887 | 2062 win = gaim_conversation_get_window(conv); |
4359 | 2063 gtkwin = GAIM_GTK_WINDOW(win); |
2064 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7887 | 2065 gc = gaim_conversation_get_gc(conv); |
4359 | 2066 |
7879 | 2067 if (gc != NULL) |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
2068 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2069 |
7887 | 2070 if (gtkwin->menu.send_as != NULL) |
2071 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); | |
2072 | |
2073 /* | |
2074 * Handle hiding and showing stuff based on what type of conv this is. | |
7929 | 2075 * Stuff that Gaim IMs support in general should be shown for IM |
2076 * conversations. Stuff that Gaim chats support in gerneal should be | |
2077 * shown for chat conversations. It doesn't matter whether the PRPL | |
2078 * supports it or not--that only affects if the button or menu item | |
2079 * is sensitive or not. | |
7887 | 2080 */ |
4359 | 2081 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
7887 | 2082 /* Show stuff that applies to IMs, hide stuff that applies to chats */ |
2083 | |
2084 /* Deal with buttons */ | |
2085 gtk_widget_show(gtkconv->info); | |
2086 gtk_widget_show(gtkconv->send); | |
2087 gtk_widget_show(gtkconv->u.im->warn); | |
2088 gtk_widget_show(gtkconv->u.im->block); | |
2089 | |
2090 /* Deal with the toolbar */ | |
2091 gtk_widget_show(gtkconv->toolbar.image); | |
2092 | |
2093 /* Deal with menu items */ | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2094 gtk_widget_show(gtkwin->menu.view_log); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2095 gtk_widget_show(gtkwin->menu.add_pounce); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2096 gtk_widget_show(gtkwin->menu.get_info); |
7887 | 2097 gtk_widget_show(gtkwin->menu.warn); |
7859 | 2098 gtk_widget_hide(gtkwin->menu.invite); |
7887 | 2099 gtk_widget_show(gtkwin->menu.alias); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2100 gtk_widget_show(gtkwin->menu.block); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2101 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2102 if (gaim_find_buddy(gaim_conversation_get_account(conv), |
7143 | 2103 gaim_conversation_get_name(conv)) == NULL) { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2104 gtk_widget_show(gtkwin->menu.add); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2105 gtk_widget_hide(gtkwin->menu.remove); |
7929 | 2106 gtk_widget_show(gtkconv->add); |
2107 gtk_widget_hide(gtkconv->remove); | |
7859 | 2108 } else { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2109 gtk_widget_show(gtkwin->menu.remove); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2110 gtk_widget_hide(gtkwin->menu.add); |
7929 | 2111 gtk_widget_hide(gtkconv->add); |
2112 gtk_widget_show(gtkconv->remove); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2113 } |
7887 | 2114 |
2115 gtk_widget_show(gtkwin->menu.insert_link); | |
2116 gtk_widget_show(gtkwin->menu.insert_image); | |
2117 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
2118 /* Show stuff that applies to IMs, hide stuff that applies to chats */ | |
2119 | |
2120 /* Deal with buttons */ | |
7952 | 2121 gtk_widget_show(gtkconv->info); |
7887 | 2122 gtk_widget_show(gtkconv->send); |
2123 gtk_widget_show(gtkconv->u.chat->invite); | |
2124 | |
2125 /* Deal with the toolbar */ | |
2126 gtk_widget_hide(gtkconv->toolbar.image); | |
2127 | |
2128 /* Deal with menu items */ | |
7859 | 2129 gtk_widget_hide(gtkwin->menu.view_log); |
2130 gtk_widget_hide(gtkwin->menu.add_pounce); | |
2131 gtk_widget_hide(gtkwin->menu.get_info); | |
7887 | 2132 gtk_widget_hide(gtkwin->menu.warn); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2133 gtk_widget_show(gtkwin->menu.invite); |
7887 | 2134 gtk_widget_show(gtkwin->menu.alias); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2135 gtk_widget_hide(gtkwin->menu.block); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2136 |
7879 | 2137 if (gaim_blist_find_chat(gaim_conversation_get_account(conv), |
2138 gaim_conversation_get_name(conv)) == NULL) { | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2139 gtk_widget_show(gtkwin->menu.add); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2140 gtk_widget_hide(gtkwin->menu.remove); |
7929 | 2141 gtk_widget_show(gtkconv->add); |
2142 gtk_widget_hide(gtkconv->remove); | |
7859 | 2143 } else { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2144 gtk_widget_show(gtkwin->menu.remove); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2145 gtk_widget_hide(gtkwin->menu.add); |
7929 | 2146 gtk_widget_hide(gtkconv->add); |
2147 gtk_widget_show(gtkconv->remove); | |
7887 | 2148 } |
2149 | |
2150 gtk_widget_show(gtkwin->menu.insert_link); | |
2151 gtk_widget_hide(gtkwin->menu.insert_image); | |
2152 } | |
2153 | |
2154 /* | |
2155 * Handle graying stuff out based on whether an account is connected | |
2156 * and what features that account supports. | |
2157 */ | |
2158 if (gc != NULL) { | |
2159 /* Account is online */ | |
2160 | |
2161 /* Deal with buttons */ | |
7929 | 2162 gtk_widget_set_sensitive(gtkconv->add, TRUE); |
2163 gtk_widget_set_sensitive(gtkconv->remove, TRUE); | |
7887 | 2164 gtk_widget_set_sensitive(gtkconv->info, (prpl_info->get_info != NULL)); |
7929 | 2165 |
7887 | 2166 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
7929 | 2167 gtk_widget_set_sensitive(gtkconv->send, (prpl_info->send_im != NULL)); |
7887 | 2168 gtk_widget_set_sensitive(gtkconv->u.im->warn, |
2169 (prpl_info->warn != NULL)); | |
2170 gtk_widget_set_sensitive(gtkconv->u.im->block, | |
2171 (prpl_info->add_deny != NULL)); | |
2172 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
2173 gtk_widget_set_sensitive(gtkconv->send, (prpl_info->chat_send != NULL)); | |
2174 gtk_widget_set_sensitive(gtkconv->u.chat->invite, | |
2175 (prpl_info->chat_invite != NULL)); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2176 } |
7887 | 2177 |
2178 /* Deal with the toolbar */ | |
7929 | 2179 gtk_widget_set_sensitive(gtkconv->toolbar.link, TRUE); |
7887 | 2180 gtk_widget_set_sensitive(gtkconv->toolbar.image, |
2181 (prpl_info->options & OPT_PROTO_IM_IMAGE)); | |
7888 | 2182 gtk_widget_set_sensitive(gtkconv->toolbar.bgcolor, |
2183 !(gc->flags & GAIM_CONNECTION_NO_BGCOLOR)); | |
7887 | 2184 |
2185 /* Deal with menu items */ | |
2186 gtk_widget_set_sensitive(gtkwin->menu.view_log, TRUE); | |
2187 gtk_widget_set_sensitive(gtkwin->menu.add_pounce, TRUE); | |
2188 gtk_widget_set_sensitive(gtkwin->menu.get_info, (prpl_info->get_info != NULL)); | |
2189 gtk_widget_set_sensitive(gtkwin->menu.warn, (prpl_info->warn != NULL)); | |
2190 gtk_widget_set_sensitive(gtkwin->menu.invite, | |
2191 (prpl_info->chat_invite != NULL)); | |
2192 | |
2193 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
2194 if (gaim_find_buddy(gaim_conversation_get_account(conv), | |
2195 gaim_conversation_get_name(conv)) == NULL) | |
2196 gtk_widget_set_sensitive(gtkwin->menu.alias, FALSE); | |
2197 else | |
2198 gtk_widget_set_sensitive(gtkwin->menu.alias, TRUE); | |
2199 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
2200 if (gaim_blist_find_chat(gaim_conversation_get_account(conv), | |
2201 gaim_conversation_get_name(conv)) == NULL) | |
2202 gtk_widget_set_sensitive(gtkwin->menu.alias, FALSE); | |
2203 else | |
2204 gtk_widget_set_sensitive(gtkwin->menu.alias, TRUE); | |
2205 } | |
2206 | |
7931 | 2207 gtk_widget_set_sensitive(gtkwin->menu.block, (prpl_info->add_deny != NULL)); |
7887 | 2208 gtk_widget_set_sensitive(gtkwin->menu.add, TRUE); |
7859 | 2209 gtk_widget_set_sensitive(gtkwin->menu.remove, TRUE); |
7887 | 2210 gtk_widget_set_sensitive(gtkwin->menu.insert_link, TRUE); |
2211 gtk_widget_set_sensitive(gtkwin->menu.insert_image, | |
2212 (prpl_info->options & OPT_PROTO_IM_IMAGE)); | |
2213 } else { | |
2214 /* Account is offline */ | |
2215 | |
2216 /* Deal with buttons */ | |
7929 | 2217 gtk_widget_set_sensitive(gtkconv->add, FALSE); |
2218 gtk_widget_set_sensitive(gtkconv->remove, FALSE); | |
7887 | 2219 gtk_widget_set_sensitive(gtkconv->info, FALSE); |
2220 gtk_widget_set_sensitive(gtkconv->send, FALSE); | |
2221 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
2222 gtk_widget_set_sensitive(gtkconv->u.im->warn, FALSE); | |
2223 gtk_widget_set_sensitive(gtkconv->u.im->block, FALSE); | |
2224 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
2225 gtk_widget_set_sensitive(gtkconv->u.chat->invite, FALSE); | |
2226 } | |
2227 | |
2228 /* Deal with the toolbar */ | |
7929 | 2229 gtk_widget_set_sensitive(gtkconv->toolbar.link, TRUE); |
7887 | 2230 gtk_widget_set_sensitive(gtkconv->toolbar.image, FALSE); |
2231 | |
2232 /* Then deal with menu items */ | |
2233 gtk_widget_set_sensitive(gtkwin->menu.view_log, TRUE); | |
2234 gtk_widget_set_sensitive(gtkwin->menu.add_pounce, TRUE); | |
2235 gtk_widget_set_sensitive(gtkwin->menu.get_info, FALSE); | |
2236 gtk_widget_set_sensitive(gtkwin->menu.warn, FALSE); | |
2237 gtk_widget_set_sensitive(gtkwin->menu.invite, FALSE); | |
2238 gtk_widget_set_sensitive(gtkwin->menu.alias, FALSE); | |
2239 gtk_widget_set_sensitive(gtkwin->menu.block, FALSE); | |
2240 gtk_widget_set_sensitive(gtkwin->menu.add, FALSE); | |
2241 gtk_widget_set_sensitive(gtkwin->menu.remove, FALSE); | |
7929 | 2242 gtk_widget_set_sensitive(gtkwin->menu.insert_link, TRUE); |
7887 | 2243 gtk_widget_set_sensitive(gtkwin->menu.insert_image, FALSE); |
2244 } | |
2245 | |
2246 /* | |
2247 * Update the window's icon | |
2248 */ | |
2249 if ((gaim_conversation_get_type(conv) == GAIM_CONV_IM) && (gtkconv->u.im->anim)) { | |
2250 window_icon = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); | |
2251 g_object_ref(window_icon); | |
2252 } else { | |
7219 | 2253 window_icon = get_tab_icon(conv); |
4359 | 2254 } |
7887 | 2255 gtk_window_set_icon(GTK_WINDOW(gtkwin->window), window_icon); |
2256 g_object_unref(G_OBJECT(window_icon)); | |
2257 } | |
2258 | |
2259 static void | |
2260 switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, | |
2261 gpointer user_data) | |
2262 { | |
2263 GaimConvWindow *win; | |
2264 GaimConversation *conv; | |
2265 GaimGtkConversation *gtkconv; | |
2266 GaimGtkWindow *gtkwin; | |
2267 | |
2268 win = (GaimConvWindow *)user_data; | |
2269 conv = gaim_conv_window_get_conversation_at(win, page_num); | |
2270 | |
2271 g_return_if_fail(conv != NULL); | |
2272 | |
2273 gtkwin = GAIM_GTK_WINDOW(win); | |
2274 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2275 | |
2276 gaim_conversation_set_unseen(conv, GAIM_UNSEEN_NONE); | |
2277 | |
2278 /* Update the menubar */ | |
2279 gray_stuff_out(conv); | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2280 |
4736 | 2281 update_typing_icon(conv); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2282 |
4359 | 2283 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.logging), |
7143 | 2284 gaim_conversation_is_logging(conv)); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2285 |
4359 | 2286 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.sounds), |
7143 | 2287 gtkconv->make_sound); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2288 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2289 gtk_check_menu_item_set_active( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2290 GTK_CHECK_MENU_ITEM(gtkwin->menu.show_formatting_toolbar), |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2291 gtkconv->show_formatting_toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2292 |
4359 | 2293 gtk_widget_grab_focus(gtkconv->entry); |
4681 | 2294 |
4965 | 2295 gtk_window_set_title(GTK_WINDOW(gtkwin->window), |
7143 | 2296 gtk_label_get_text(GTK_LABEL(gtkconv->tab_label))); |
4359 | 2297 } |
2298 | |
2299 /************************************************************************** | |
2300 * Utility functions | |
2301 **************************************************************************/ | |
2302 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2303 do_bold(GtkWidget *bold, GaimGtkConversation *gtkconv) |
4359 | 2304 { |
7988 | 2305 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(bold))) |
2306 gaim_gtk_surround(gtkconv, "<B>", "</B>"); | |
2307 else | |
2308 gaim_gtk_advance_past(gtkconv, "<B>", "</B>"); | |
2309 | |
4359 | 2310 gtk_widget_grab_focus(gtkconv->entry); |
2311 } | |
2312 | |
2313 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2314 do_italic(GtkWidget *italic, GaimGtkConversation *gtkconv) |
4359 | 2315 { |
7988 | 2316 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(italic))) |
2317 gaim_gtk_surround(gtkconv, "<I>", "</I>"); | |
2318 else | |
2319 gaim_gtk_advance_past(gtkconv, "<I>", "</I>"); | |
2320 | |
4359 | 2321 gtk_widget_grab_focus(gtkconv->entry); |
2322 } | |
2323 | |
2324 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2325 do_underline(GtkWidget *underline, GaimGtkConversation *gtkconv) |
4359 | 2326 { |
7988 | 2327 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(underline))) |
2328 gaim_gtk_surround(gtkconv, "<U>", "</U>"); | |
2329 else | |
2330 gaim_gtk_advance_past(gtkconv, "<U>", "</U>"); | |
2331 | |
4359 | 2332 gtk_widget_grab_focus(gtkconv->entry); |
2333 } | |
2334 | |
2335 static void | |
7242
59ffe137176d
[gaim-migrate @ 7817]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7222
diff
changeset
|
2336 do_small(GtkWidget *smalltb, GaimGtkConversation *gtkconv) |
4359 | 2337 { |
7988 | 2338 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(smalltb))) |
2339 gaim_gtk_surround(gtkconv, "<FONT SIZE=\"1\">", "</FONT>"); | |
2340 else | |
2341 gaim_gtk_advance_past(gtkconv, "<FONT SIZE=\"1\">", "</FONT>"); | |
2342 | |
2343 gtk_widget_grab_focus(gtkconv->entry); | |
2344 } | |
2345 | |
2346 static void | |
2347 do_normal(GtkWidget *normal, GaimGtkConversation *gtkconv) | |
2348 { | |
2349 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(normal))) | |
2350 gaim_gtk_surround(gtkconv, "<FONT SIZE=\"3\">", "</FONT>"); | |
2351 else | |
2352 gaim_gtk_advance_past(gtkconv, "<FONT SIZE=\"3\">", "</FONT>"); | |
2353 | |
4359 | 2354 gtk_widget_grab_focus(gtkconv->entry); |
2355 } | |
2356 | |
2357 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2358 do_big(GtkWidget *large, GaimGtkConversation *gtkconv) |
4359 | 2359 { |
7988 | 2360 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(large))) |
2361 gaim_gtk_surround(gtkconv, "<FONT SIZE=\"5\">", "</FONT>"); | |
2362 else | |
2363 gaim_gtk_advance_past(gtkconv, "<FONT SIZE=\"5\">", "</FONT>"); | |
2364 | |
4359 | 2365 gtk_widget_grab_focus(gtkconv->entry); |
2366 } | |
2367 | |
2368 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2369 toggle_font(GtkWidget *font, GaimConversation *conv) |
4359 | 2370 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2371 GaimGtkConversation *gtkconv; |
4359 | 2372 |
2373 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2374 | |
7988 | 2375 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(font))) |
2376 show_font_dialog(conv, font); | |
2377 else if (gtkconv->dialogs.font != NULL) | |
2378 cancel_font(font, conv); | |
2379 else | |
2380 gaim_gtk_advance_past(gtkconv, "<FONT FACE>", "</FONT>"); | |
4359 | 2381 } |
2382 | |
2383 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2384 toggle_fg_color(GtkWidget *color, GaimConversation *conv) |
4359 | 2385 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2386 GaimGtkConversation *gtkconv; |
4359 | 2387 |
2388 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2389 | |
2390 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(color))) | |
2391 show_fgcolor_dialog(conv, color); | |
2392 else if (gtkconv->dialogs.fg_color != NULL) | |
2393 cancel_fgcolor(color, conv); | |
2394 else | |
2395 gaim_gtk_advance_past(gtkconv, "<FONT COLOR>", "</FONT>"); | |
2396 } | |
2397 | |
2398 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2399 toggle_bg_color(GtkWidget *color, GaimConversation *conv) |
4359 | 2400 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2401 GaimGtkConversation *gtkconv; |
4359 | 2402 |
2403 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2404 | |
2405 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(color))) | |
2406 show_bgcolor_dialog(conv, color); | |
2407 else if (gtkconv->dialogs.bg_color != NULL) | |
2408 cancel_bgcolor(color, conv); | |
2409 else | |
2410 gaim_gtk_advance_past(gtkconv, "<BODY BGCOLOR>", "</BODY>"); | |
2411 } | |
2412 | |
2413 static void | |
2414 check_everything(GtkTextBuffer *buffer) | |
2415 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2416 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2417 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2418 |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2419 conv = (GaimConversation *)g_object_get_data(G_OBJECT(buffer), |
4359 | 2420 "user_data"); |
2421 | |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2422 g_return_if_fail(conv != NULL); |
4359 | 2423 |
2424 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2425 | |
2426 /* CONV TODO */ | |
2427 } | |
2428 | |
2429 static void | |
4685 | 2430 set_toggle(GtkWidget *tb, gboolean active) |
4359 | 2431 { |
2432 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(tb), active); | |
2433 } | |
2434 | |
2435 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2436 got_typing_keypress(GaimConversation *conv, gboolean first) |
4359 | 2437 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2438 GaimConvIm *im; |
4685 | 2439 |
4359 | 2440 /* |
2441 * We know we got something, so we at least have to make sure we don't | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
2442 * send GAIM_TYPED any time soon. |
4359 | 2443 */ |
2444 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2445 im = GAIM_CONV_IM(conv); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2446 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2447 if (gaim_conv_im_get_type_again_timeout(im)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2448 gaim_conv_im_stop_type_again_timeout(im); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2449 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2450 gaim_conv_im_start_type_again_timeout(im); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2451 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2452 if (first || (gaim_conv_im_get_type_again(im) != 0 && |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2453 time(NULL) > gaim_conv_im_get_type_again(im))) { |
4359 | 2454 |
2455 int timeout = serv_send_typing(gaim_conversation_get_gc(conv), | |
2456 (char *)gaim_conversation_get_name(conv), | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
2457 GAIM_TYPING); |
4359 | 2458 |
2459 if (timeout) | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2460 gaim_conv_im_set_type_again(im, time(NULL) + timeout); |
4359 | 2461 else |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2462 gaim_conv_im_set_type_again(im, 0); |
4359 | 2463 } |
2464 } | |
2465 | |
4736 | 2466 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2467 update_typing_icon(GaimConversation *conv) |
4736 | 2468 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2469 GaimGtkWindow *gtkwin; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2470 GaimConvIm *im = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2471 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); |
4736 | 2472 |
2473 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); | |
2474 | |
2475 if(gaim_conversation_get_type(conv) == GAIM_CONV_IM) | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2476 im = GAIM_CONV_IM(conv); |
4736 | 2477 |
2478 if(gtkwin->menu.typing_icon) { | |
2479 gtk_widget_destroy(gtkwin->menu.typing_icon); | |
2480 gtkwin->menu.typing_icon = NULL; | |
2481 } | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2482 if(im && gaim_conv_im_get_typing_state(im) == GAIM_TYPING) { |
4736 | 2483 gtkwin->menu.typing_icon = gtk_image_menu_item_new(); |
2484 gtk_image_menu_item_set_image( | |
2485 GTK_IMAGE_MENU_ITEM(gtkwin->menu.typing_icon), | |
2486 gtk_image_new_from_stock(GAIM_STOCK_TYPING, | |
2487 GTK_ICON_SIZE_MENU)); | |
4757 | 2488 gtk_tooltips_set_tip(gtkconv->tooltips, gtkwin->menu.typing_icon, |
4736 | 2489 _("User is typing..."), NULL); |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2490 } else if(im && gaim_conv_im_get_typing_state(im) == GAIM_TYPED) { |
4736 | 2491 gtkwin->menu.typing_icon = gtk_image_menu_item_new(); |
2492 gtk_image_menu_item_set_image( | |
2493 GTK_IMAGE_MENU_ITEM(gtkwin->menu.typing_icon), | |
2494 gtk_image_new_from_stock(GAIM_STOCK_TYPED, | |
2495 GTK_ICON_SIZE_MENU)); | |
4757 | 2496 gtk_tooltips_set_tip(gtkconv->tooltips, gtkwin->menu.typing_icon, |
4736 | 2497 _("User has typed something and paused"), NULL); |
2498 } | |
2499 | |
2500 if(gtkwin->menu.typing_icon) { | |
2501 gtk_menu_item_set_right_justified( | |
2502 GTK_MENU_ITEM(gtkwin->menu.typing_icon), TRUE); | |
2503 gtk_widget_show_all(gtkwin->menu.typing_icon); | |
2504 gtk_menu_shell_append(GTK_MENU_SHELL(gtkwin->menu.menubar), | |
2505 gtkwin->menu.typing_icon); | |
2506 } | |
2507 } | |
2508 | |
4685 | 2509 static gboolean |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2510 update_send_as_selection(GaimConvWindow *win) |
4359 | 2511 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2512 GaimAccount *account; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2513 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2514 GaimGtkWindow *gtkwin; |
4359 | 2515 GtkWidget *menu; |
2516 GList *child; | |
2517 | |
7090
04f9f7440bc3
[gaim-migrate @ 7655]
Christian Hammond <chipx86@chipx86.com>
parents:
7089
diff
changeset
|
2518 if (g_list_find(gaim_get_windows(), win) == NULL) |
04f9f7440bc3
[gaim-migrate @ 7655]
Christian Hammond <chipx86@chipx86.com>
parents:
7089
diff
changeset
|
2519 return FALSE; |
4849 | 2520 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2521 conv = gaim_conv_window_get_active_conversation(win); |
4359 | 2522 |
5860
52d5fad43950
[gaim-migrate @ 6291]
Christian Hammond <chipx86@chipx86.com>
parents:
5858
diff
changeset
|
2523 if (conv == NULL) |
52d5fad43950
[gaim-migrate @ 6291]
Christian Hammond <chipx86@chipx86.com>
parents:
5858
diff
changeset
|
2524 return FALSE; |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2525 |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2526 account = gaim_conversation_get_account(conv); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2527 gtkwin = GAIM_GTK_WINDOW(win); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2528 |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2529 if (gtkwin->menu.send_as == NULL) |
4685 | 2530 return FALSE; |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2531 |
4359 | 2532 gtk_widget_show(gtkwin->menu.send_as); |
2533 | |
2534 menu = gtk_menu_item_get_submenu( | |
2535 GTK_MENU_ITEM(gtkwin->menu.send_as)); | |
2536 | |
2537 for (child = gtk_container_get_children(GTK_CONTAINER(menu)); | |
2538 child != NULL; | |
2539 child = child->next) { | |
2540 | |
2541 GtkWidget *item = child->data; | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2542 GaimAccount *item_account = g_object_get_data(G_OBJECT(item), |
4673 | 2543 "gaim_account"); |
2544 | |
2545 if (account == item_account) { | |
4359 | 2546 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE); |
2547 break; | |
2548 } | |
2549 } | |
6030
54c37db13279
[gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents:
6016
diff
changeset
|
2550 |
4685 | 2551 return FALSE; |
4359 | 2552 } |
2553 | |
2554 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2555 generate_send_as_items(GaimConvWindow *win, GaimConversation *deleted_conv) |
4359 | 2556 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2557 GaimGtkWindow *gtkwin; |
4359 | 2558 GtkWidget *menu; |
2559 GtkWidget *menuitem; | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2560 GList *gcs; |
4359 | 2561 GList *convs; |
2562 GSList *group = NULL; | |
2563 gboolean first_offline = TRUE; | |
2564 gboolean found_online = FALSE; | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2565 GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
4359 | 2566 |
2567 gtkwin = GAIM_GTK_WINDOW(win); | |
2568 | |
2569 if (gtkwin->menu.send_as != NULL) | |
2570 gtk_widget_destroy(gtkwin->menu.send_as); | |
2571 | |
2572 /* See if we have > 1 connection active. */ | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2573 if (g_list_length(gaim_connections_get_all()) < 2) { |
4359 | 2574 /* Now make sure we don't have any Offline entries. */ |
2575 gboolean found_offline = FALSE; | |
2576 | |
2577 for (convs = gaim_get_conversations(); | |
2578 convs != NULL; | |
2579 convs = convs->next) { | |
2580 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2581 GaimConversation *conv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2582 GaimAccount *account; |
4491 | 2583 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2584 conv = (GaimConversation *)convs->data; |
4491 | 2585 account = gaim_conversation_get_account(conv); |
2586 | |
6495
8ce66049ce68
[gaim-migrate @ 7010]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
2587 if (account != NULL && account->gc == NULL) { |
4359 | 2588 found_offline = TRUE; |
2589 break; | |
2590 } | |
2591 } | |
2592 | |
2593 if (!found_offline) { | |
2594 gtkwin->menu.send_as = NULL; | |
2595 return; | |
2596 } | |
2597 } | |
2598 | |
2599 /* Build the Send As menu */ | |
2600 gtkwin->menu.send_as = gtk_menu_item_new_with_mnemonic(_("_Send As")); | |
2601 gtk_widget_show(gtkwin->menu.send_as); | |
2602 | |
2603 menu = gtk_menu_new(); | |
7857
43f63ff8a6d8
[gaim-migrate @ 8511]
Christian Hammond <chipx86@chipx86.com>
parents:
7855
diff
changeset
|
2604 gtk_menu_shell_insert(GTK_MENU_SHELL(gtkwin->menu.menubar), |
43f63ff8a6d8
[gaim-migrate @ 8511]
Christian Hammond <chipx86@chipx86.com>
parents:
7855
diff
changeset
|
2605 gtkwin->menu.send_as, 2); |
4359 | 2606 gtk_menu_item_set_submenu(GTK_MENU_ITEM(gtkwin->menu.send_as), menu); |
2607 | |
2608 gtk_widget_show(menu); | |
2609 | |
2610 /* Fill it with entries. */ | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2611 for (gcs = gaim_connections_get_all(); gcs != NULL; gcs = gcs->next) { |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2612 |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2613 GaimConnection *gc; |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2614 GaimAccount *account; |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2615 GtkWidget *box; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2616 GtkWidget *label; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2617 GtkWidget *image; |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2618 GdkPixbuf *pixbuf, *scale; |
4359 | 2619 |
2620 found_online = TRUE; | |
2621 | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2622 gc = (GaimConnection *)gcs->data; |
4359 | 2623 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2624 /* Create a pixmap for the protocol icon. */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2625 pixbuf = create_prpl_icon(gc->account); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2626 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, GDK_INTERP_BILINEAR); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2627 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2628 /* Now convert it to GtkImage */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2629 if (pixbuf == NULL) |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2630 image = gtk_image_new(); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2631 else |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2632 image = gtk_image_new_from_pixbuf(scale); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2633 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2634 gtk_size_group_add_widget(sg, image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2635 |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2636 g_object_unref(G_OBJECT(scale)); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2637 g_object_unref(G_OBJECT(pixbuf)); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2638 |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2639 account = gaim_connection_get_account(gc); |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2640 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2641 /* Make our menu item */ |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2642 menuitem = gtk_radio_menu_item_new_with_label(group, |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2643 gaim_account_get_username(account)); |
4793 | 2644 group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem)); |
4359 | 2645 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2646 /* Do some evil, see some evil, speak some evil. */ |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2647 box = gtk_hbox_new(FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2648 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2649 label = gtk_bin_get_child(GTK_BIN(menuitem)); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2650 g_object_ref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2651 gtk_container_remove(GTK_CONTAINER(menuitem), label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2652 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2653 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2654 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 4); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2655 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2656 g_object_unref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2657 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2658 gtk_container_add(GTK_CONTAINER(menuitem), box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2659 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2660 gtk_widget_show(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2661 gtk_widget_show(image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2662 gtk_widget_show(box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2663 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2664 /* Set our data and callbacks. */ |
4359 | 2665 g_object_set_data(G_OBJECT(menuitem), "user_data", win); |
4673 | 2666 g_object_set_data(G_OBJECT(menuitem), "gaim_account", gc->account); |
4359 | 2667 |
4786 | 2668 g_signal_connect(G_OBJECT(menuitem), "activate", |
4673 | 2669 G_CALLBACK(menu_conv_sel_send_cb), NULL); |
4359 | 2670 |
2671 gtk_widget_show(menuitem); | |
2672 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
2673 } | |
2674 | |
2675 /* | |
2676 * Fill it with any accounts that still has an open (yet disabled) window | |
2677 * (signed off accounts with a window open). | |
2678 */ | |
2679 for (convs = gaim_get_conversations(); | |
2680 convs != NULL; | |
2681 convs = convs->next) { | |
2682 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2683 GaimConversation *conv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2684 GaimAccount *account; |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2685 GtkWidget *box; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2686 GtkWidget *label; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2687 GtkWidget *image; |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2688 GdkPixbuf *pixbuf, *scale; |
4359 | 2689 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2690 conv = (GaimConversation *)convs->data; |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
2691 |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
2692 if (conv == deleted_conv) |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
2693 continue; |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
2694 |
4491 | 2695 account = gaim_conversation_get_account(conv); |
2696 | |
6495
8ce66049ce68
[gaim-migrate @ 7010]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
2697 if (account != NULL && account->gc == NULL) { |
4359 | 2698 if (first_offline && found_online) { |
2699 menuitem = gtk_separator_menu_item_new(); | |
2700 gtk_widget_show(menuitem); | |
2701 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
2702 | |
2703 first_offline = FALSE; | |
2704 } | |
2705 | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2706 /* Create a pixmap for the protocol icon. */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2707 pixbuf = create_prpl_icon(account); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2708 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2709 GDK_INTERP_BILINEAR); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2710 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2711 /* Now convert it to GtkImage */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2712 if (pixbuf == NULL) |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2713 image = gtk_image_new(); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2714 else |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2715 image = gtk_image_new_from_pixbuf(scale); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2716 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2717 gtk_size_group_add_widget(sg, image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2718 |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2719 if (scale != NULL) g_object_unref(scale); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2720 if (pixbuf != NULL) g_object_unref(pixbuf); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2721 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2722 /* Make our menu item */ |
4359 | 2723 menuitem = gtk_radio_menu_item_new_with_label(group, |
4491 | 2724 account->username); |
4793 | 2725 group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem)); |
4359 | 2726 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2727 /* Do some evil, see some evil, speak some evil. */ |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2728 box = gtk_hbox_new(FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2729 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2730 label = gtk_bin_get_child(GTK_BIN(menuitem)); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2731 g_object_ref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2732 gtk_container_remove(GTK_CONTAINER(menuitem), label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2733 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2734 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2735 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 4); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2736 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2737 g_object_unref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2738 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2739 gtk_container_add(GTK_CONTAINER(menuitem), box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2740 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2741 gtk_widget_show(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2742 gtk_widget_show(image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2743 gtk_widget_show(box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2744 |
4359 | 2745 gtk_widget_set_sensitive(menuitem, FALSE); |
4786 | 2746 g_object_set_data(G_OBJECT(menuitem), "user_data", win); |
4674 | 2747 g_object_set_data(G_OBJECT(menuitem), "gaim_account", account); |
4359 | 2748 |
4786 | 2749 g_signal_connect(G_OBJECT(menuitem), "activate", |
5902
6889b89cab90
[gaim-migrate @ 6334]
Christian Hammond <chipx86@chipx86.com>
parents:
5901
diff
changeset
|
2750 G_CALLBACK(menu_conv_sel_send_cb), NULL); |
4786 | 2751 |
4359 | 2752 gtk_widget_show(menuitem); |
2753 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
2754 } | |
2755 } | |
2756 | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2757 g_object_unref(sg); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2758 |
4359 | 2759 gtk_widget_show(gtkwin->menu.send_as); |
2760 update_send_as_selection(win); | |
2761 } | |
2762 | |
2763 static GList * | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2764 generate_invite_user_names(GaimConnection *gc) |
4359 | 2765 { |
6695 | 2766 GaimBlistNode *gnode,*cnode,*bnode; |
4359 | 2767 static GList *tmp = NULL; |
2768 | |
2769 if (tmp) | |
2770 g_list_free(tmp); | |
2771 | |
2772 tmp = g_list_append(NULL, ""); | |
2773 | |
2774 if (gc != NULL) { | |
4785 | 2775 for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { |
2776 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) | |
2777 continue; | |
6695 | 2778 for(cnode = gnode->child; cnode; cnode = cnode->next) { |
2779 if(!GAIM_BLIST_NODE_IS_CONTACT(cnode)) | |
4785 | 2780 continue; |
6695 | 2781 for(bnode = cnode->child; bnode; bnode = bnode->next) { |
2782 GaimBuddy *buddy; | |
2783 | |
2784 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) | |
2785 continue; | |
2786 | |
2787 buddy = (GaimBuddy *)bnode; | |
2788 | |
2789 if (buddy->account == gc->account && | |
2790 GAIM_BUDDY_IS_ONLINE(buddy)) | |
2791 tmp = g_list_append(tmp, buddy->name); | |
2792 } | |
4359 | 2793 } |
2794 } | |
2795 } | |
2796 | |
2797 return tmp; | |
2798 } | |
2799 | |
2800 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2801 add_chat_buddy_common(GaimConversation *conv, const char *name, int pos) |
4359 | 2802 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2803 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2804 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2805 GaimConvChat *chat; |
4359 | 2806 GtkTreeIter iter; |
2807 GtkListStore *ls; | |
2808 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2809 chat = GAIM_CONV_CHAT(conv); |
4359 | 2810 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2811 gtkchat = gtkconv->u.chat; | |
2812 | |
2813 ls = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list))); | |
2814 | |
2815 gtk_list_store_append(ls, &iter); | |
2816 gtk_list_store_set(ls, &iter, 0, | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2817 (gaim_conv_chat_is_user_ignored(chat, name) ? "X" : " "), |
4359 | 2818 1, name, -1); |
2819 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), 1, | |
2820 GTK_SORT_ASCENDING); | |
2821 } | |
2822 | |
2823 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2824 tab_complete(GaimConversation *conv) |
4359 | 2825 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2826 GaimGtkConversation *gtkconv; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2827 GaimConvChat *chat; |
4359 | 2828 GtkTextIter cursor, word_start, start_buffer; |
2829 int start; | |
2830 int most_matched = -1; | |
2831 char *entered, *partial = NULL; | |
2832 char *text; | |
2833 GList *matches = NULL; | |
2834 GList *nicks = NULL; | |
2835 | |
2836 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2837 chat = GAIM_CONV_CHAT(conv); |
4359 | 2838 |
2839 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_buffer); | |
2840 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, | |
2841 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
2842 | |
2843 word_start = cursor; | |
2844 | |
2845 /* if there's nothing there just return */ | |
2846 if (!gtk_text_iter_compare(&cursor, &start_buffer)) | |
2847 return; | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2848 |
4359 | 2849 text = gtk_text_buffer_get_text(gtkconv->entry_buffer, &start_buffer, |
2850 &cursor, FALSE); | |
2851 | |
2852 /* if we're at the end of ": " we need to move back 2 spaces */ | |
2853 start = strlen(text) - 1; | |
2854 | |
2855 if (strlen(text) >= 2 && !strncmp(&text[start-1], ": ", 2)) | |
2856 gtk_text_iter_backward_chars(&word_start, 2); | |
2857 | |
2858 /* find the start of the word that we're tabbing */ | |
2859 while (start >= 0 && text[start] != ' ') { | |
2860 gtk_text_iter_backward_char(&word_start); | |
2861 start--; | |
2862 } | |
2863 | |
2864 g_free(text); | |
2865 | |
2866 entered = gtk_text_buffer_get_text(gtkconv->entry_buffer, &word_start, | |
2867 &cursor, FALSE); | |
2868 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
2869 if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/old_tab_complete")) { |
4359 | 2870 if (strlen(entered) >= 2 && |
2871 !strncmp(": ", entered + strlen(entered) - 2, 2)) { | |
2872 | |
2873 entered[strlen(entered) - 2] = 0; | |
2874 } | |
2875 } | |
2876 | |
2877 if (!strlen(entered)) { | |
2878 g_free(entered); | |
2879 return; | |
2880 } | |
2881 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2882 for (nicks = gaim_conv_chat_get_users(chat); |
4359 | 2883 nicks != NULL; |
2884 nicks = nicks->next) { | |
2885 | |
2886 char *nick = nicks->data; | |
2887 /* this checks to see if the current nick could be a completion */ | |
4793 | 2888 if (g_ascii_strncasecmp(nick, entered, strlen(entered))) { |
2889 if (g_ascii_strncasecmp(nick + 1, entered, strlen(entered))) { | |
2890 if (g_ascii_strncasecmp(nick + 2, entered, strlen(entered))) | |
4359 | 2891 continue; |
2892 else | |
2893 nick += 2; | |
2894 } | |
2895 else | |
2896 nick++; | |
2897 } | |
2898 | |
2899 /* if we're here, it's a possible completion */ | |
2900 | |
2901 /* 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
|
2902 if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/old_tab_complete")) { |
4359 | 2903 gtk_text_buffer_delete(gtkconv->entry_buffer, |
2904 &word_start, &cursor); | |
2905 | |
2906 if (strlen(nick) == strlen(entered)) { | |
2907 nicks = (nicks->next | |
2908 ? nicks->next | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2909 : gaim_conv_chat_get_users(chat)); |
4359 | 2910 |
2911 nick = nicks->data; | |
2912 } | |
2913 | |
2914 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, | |
2915 &start_buffer); | |
2916 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, | |
2917 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
2918 | |
2919 if (!gtk_text_iter_compare(&cursor, &start_buffer)) { | |
2920 char *tmp = g_strdup_printf("%s: ", nick); | |
2921 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, | |
2922 tmp, -1); | |
2923 g_free(tmp); | |
2924 } | |
2925 else | |
2926 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, | |
2927 nick, -1); | |
2928 | |
2929 g_free(entered); | |
2930 | |
2931 return; | |
2932 } | |
2933 | |
2934 /* we're only here if we're doing new style */ | |
2935 if (most_matched == -1) { | |
2936 /* | |
2937 * this will only get called once, since from now | |
2938 * on most_matched is >= 0 | |
2939 */ | |
2940 most_matched = strlen(nick); | |
2941 partial = g_strdup(nick); | |
2942 } | |
2943 else if (most_matched) { | |
4793 | 2944 while (g_ascii_strncasecmp(nick, partial, most_matched)) |
4359 | 2945 most_matched--; |
2946 | |
2947 partial[most_matched] = 0; | |
2948 } | |
2949 | |
2950 matches = g_list_append(matches, nick); | |
2951 } | |
2952 | |
2953 /* we're only here if we're doing new style */ | |
2954 | |
2955 /* if there weren't any matches, return */ | |
2956 if (!matches) { | |
2957 /* if matches isn't set partials won't be either */ | |
2958 g_free(entered); | |
2959 return; | |
2960 } | |
2961 | |
2962 gtk_text_buffer_delete(gtkconv->entry_buffer, &word_start, &cursor); | |
2963 | |
2964 if (!matches->next) { | |
2965 /* there was only one match. fill it in. */ | |
2966 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_buffer); | |
2967 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, | |
2968 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
2969 | |
2970 if (!gtk_text_iter_compare(&cursor, &start_buffer)) { | |
2971 char *tmp = g_strdup_printf("%s: ", (char *)matches->data); | |
2972 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, tmp, -1); | |
2973 g_free(tmp); | |
2974 } | |
2975 else | |
2976 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, | |
2977 matches->data, -1); | |
2978 | |
2979 matches = g_list_remove(matches, matches->data); | |
2980 } | |
2981 else { | |
2982 /* | |
2983 * there were lots of matches, fill in as much as possible | |
2984 * and display all of them | |
2985 */ | |
2986 char *addthis = g_malloc0(1); | |
2987 | |
2988 while (matches) { | |
2989 char *tmp = addthis; | |
2990 addthis = g_strconcat(tmp, matches->data, " ", NULL); | |
2991 g_free(tmp); | |
2992 matches = g_list_remove(matches, matches->data); | |
2993 } | |
2994 | |
6982 | 2995 gaim_conversation_write(conv, NULL, addthis, GAIM_MESSAGE_NO_LOG, |
4359 | 2996 time(NULL)); |
2997 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, partial, -1); | |
2998 g_free(addthis); | |
2999 } | |
3000 | |
3001 g_free(entered); | |
3002 g_free(partial); | |
3003 } | |
3004 | |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3005 static void |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3006 save_convo(GtkWidget *save, GaimConversation *c) |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3007 { |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3008 char buf[BUF_LONG]; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3009 GtkWidget *window; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3010 |
7859 | 3011 window = gtk_file_selection_new(_("Save Conversation")); |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3012 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3013 g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S "%s.log", |
7261 | 3014 gaim_home_dir(), gaim_normalize(c->account, c->name)); |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3015 gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3016 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
|
3017 "gaim_conversation", c); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3018 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(window)->ok_button), |
6038 | 3019 "clicked", G_CALLBACK(do_check_save_convo), window); |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3020 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
|
3021 "clicked", G_CALLBACK(gtk_widget_destroy), (gpointer)window); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3022 gtk_widget_show(window); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3023 } |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3024 |
4359 | 3025 static GtkItemFactoryEntry menu_items[] = |
3026 { | |
3027 /* Conversation menu */ | |
4596 | 3028 { N_("/_Conversation"), NULL, NULL, 0, "<Branch>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3029 |
7887 | 3030 { N_("/Conversation/New Instant _Message..."), "<CTL>M", menu_new_conv_cb, |
7859 | 3031 0, "<StockItem>", GAIM_STOCK_IM }, |
3032 | |
3033 { "/Conversation/sep0", NULL, NULL, 0, "<Separator>" }, | |
3034 | |
7880 | 3035 { N_("/Conversation/_Find..."), NULL, menu_find_cb, 0, "<StockItem>", GTK_STOCK_FIND }, |
7859 | 3036 { N_("/Conversation/View _Log"), NULL, menu_view_log_cb, 0, NULL }, |
4596 | 3037 { N_("/Conversation/_Save As..."), NULL, menu_save_as_cb, 0, |
4359 | 3038 "<StockItem>", GTK_STOCK_SAVE_AS }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3039 |
4359 | 3040 { "/Conversation/sep1", NULL, NULL, 0, "<Separator>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3041 |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
3042 { N_("/Conversation/Add Buddy _Pounce..."), NULL, menu_add_pounce_cb, |
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
3043 0, NULL }, |
7859 | 3044 { N_("/Conversation/_Get Info"), NULL, menu_get_info_cb, 0, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3045 "<StockItem>", GAIM_STOCK_INFO }, |
7859 | 3046 { N_("/Conversation/_Warn..."), NULL, menu_warn_cb, 0, |
3047 "<StockItem>", GAIM_STOCK_WARN }, | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3048 { N_("/Conversation/In_vite..."), NULL, menu_invite_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3049 "<StockItem>", GAIM_STOCK_INVITE }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3050 |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
3051 { "/Conversation/sep2", NULL, NULL, 0, "<Separator>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3052 |
7859 | 3053 { N_("/Conversation/A_lias..."), NULL, menu_alias_cb, 0, |
3054 "<StockItem>", GAIM_STOCK_EDIT }, | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3055 { N_("/Conversation/_Block..."), NULL, menu_block_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3056 "<StockItem>", GAIM_STOCK_BLOCK }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3057 { N_("/Conversation/_Add..."), NULL, menu_add_remove_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3058 "<StockItem>", GTK_STOCK_ADD }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3059 { N_("/Conversation/_Remove..."), NULL, menu_add_remove_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3060 "<StockItem>", GTK_STOCK_REMOVE }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3061 |
7859 | 3062 { "/Conversation/sep3", NULL, NULL, 0, "<Separator>" }, |
3063 | |
3064 { N_("/Conversation/Insert Lin_k..."), NULL, menu_insert_link_cb, 0, | |
3065 "<StockItem>", GAIM_STOCK_LINK }, | |
3066 { N_("/Conversation/Insert Imag_e..."), NULL, menu_insert_image_cb, 0, | |
3067 "<StockItem>", GAIM_STOCK_IMAGE }, | |
3068 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3069 { "/Conversation/sep4", NULL, NULL, 0, "<Separator>" }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3070 |
4596 | 3071 { N_("/Conversation/_Close"), NULL, menu_close_conv_cb, 0, |
4359 | 3072 "<StockItem>", GTK_STOCK_CLOSE }, |
3073 | |
3074 /* Options */ | |
4596 | 3075 { N_("/_Options"), NULL, NULL, 0, "<Branch>" }, |
3076 { N_("/Options/Enable _Logging"), NULL, menu_logging_cb, 0, "<CheckItem>" }, | |
3077 { N_("/Options/Enable _Sounds"), NULL, menu_sounds_cb, 0, "<CheckItem>" }, | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3078 { N_("/Options/Show Formatting _Toolbar"), NULL, menu_toolbar_cb, 0, "<CheckItem>" }, |
4359 | 3079 }; |
3080 | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
3081 static const int menu_item_count = |
4359 | 3082 sizeof(menu_items) / sizeof(*menu_items); |
3083 | |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3084 static char * |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3085 item_factory_translate_func (const char *path, gpointer func_data) |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3086 { |
7386 | 3087 return _((char *)path); |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3088 } |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3089 |
4359 | 3090 static GtkWidget * |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3091 setup_menubar(GaimConvWindow *win) |
4359 | 3092 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3093 GaimGtkWindow *gtkwin; |
5116 | 3094 GtkAccelGroup *accel_group; |
4359 | 3095 gtkwin = GAIM_GTK_WINDOW(win); |
3096 | |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
3097 accel_group = gtk_accel_group_new (); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
3098 gtk_window_add_accel_group (GTK_WINDOW (gtkwin->window), accel_group); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
3099 g_object_unref (accel_group); |
5116 | 3100 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3101 gtkwin->menu.item_factory = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3102 gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<main>", accel_group); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3103 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3104 gtk_item_factory_set_translate_func(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3105 item_factory_translate_func, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3106 NULL, NULL); |
4630 | 3107 |
3108 gtk_item_factory_create_items(gtkwin->menu.item_factory, menu_item_count, | |
4359 | 3109 menu_items, win); |
7420 | 3110 g_signal_connect(G_OBJECT(accel_group), "accel-changed", |
3111 G_CALLBACK(gaim_gtk_save_accels_cb), NULL); | |
4359 | 3112 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3113 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3114 gtkwin->menu.menubar = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3115 gtk_item_factory_get_widget(gtkwin->menu.item_factory, "<main>"); |
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 gtkwin->menu.view_log = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3119 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
7295 | 3120 N_("/Conversation/View Log")); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3121 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3122 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3123 gtkwin->menu.add_pounce = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3124 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3125 N_("/Conversation/Add Buddy Pounce...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3126 |
7879 | 3127 /* --- */ |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3128 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3129 gtkwin->menu.get_info = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3130 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
7859 | 3131 N_("/Conversation/Get Info")); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3132 |
7879 | 3133 gtkwin->menu.warn = |
3134 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3135 N_("/Conversation/Warn...")); | |
3136 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3137 gtkwin->menu.invite = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3138 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3139 N_("/Conversation/Invite...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3140 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3141 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3142 |
7879 | 3143 gtkwin->menu.alias = |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3144 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
7879 | 3145 N_("/Conversation/Alias...")); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3146 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3147 gtkwin->menu.block = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3148 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3149 N_("/Conversation/Block...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3150 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3151 gtkwin->menu.add = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3152 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3153 N_("/Conversation/Add...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3154 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3155 gtkwin->menu.remove = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3156 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3157 N_("/Conversation/Remove...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3158 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3159 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3160 |
7879 | 3161 gtkwin->menu.insert_link = |
3162 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3163 N_("/Conversation/Insert Link...")); | |
3164 | |
3165 gtkwin->menu.insert_image = | |
3166 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3167 N_("/Conversation/Insert Image...")); | |
3168 | |
3169 /* --- */ | |
3170 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3171 gtkwin->menu.logging = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3172 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3173 N_("/Options/Enable Logging")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3174 gtkwin->menu.sounds = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3175 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3176 N_("/Options/Enable Sounds")); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3177 gtkwin->menu.show_formatting_toolbar = |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3178 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3179 N_("/Options/Show Formatting Toolbar")); |
4359 | 3180 |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3181 generate_send_as_items(win, NULL); |
4359 | 3182 |
3183 gtk_widget_show(gtkwin->menu.menubar); | |
4931 | 3184 |
3185 return gtkwin->menu.menubar; | |
4359 | 3186 } |
3187 | |
3188 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3189 setup_im_buttons(GaimConversation *conv, GtkWidget *parent) |
4359 | 3190 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3191 GaimConnection *gc; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3192 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3193 GaimGtkImPane *gtkim; |
4359 | 3194 |
3195 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3196 gtkim = gtkconv->u.im; | |
3197 gc = gaim_conversation_get_gc(conv); | |
3198 | |
3199 /* From right to left... */ | |
3200 | |
3201 /* Send button */ | |
3202 gtkconv->send = gaim_gtk_change_text(_("Send"), gtkconv->send, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3203 GAIM_STOCK_SEND, GAIM_CONV_IM); |
4359 | 3204 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->send, _("Send"), NULL); |
3205 gtk_box_pack_end(GTK_BOX(parent), gtkconv->send, FALSE, FALSE, 0); | |
3206 | |
3207 /* Separator */ | |
3208 if (gtkim->sep2 != NULL) | |
3209 gtk_widget_destroy(gtkim->sep2); | |
3210 | |
3211 gtkim->sep2 = gtk_vseparator_new(); | |
3212 gtk_box_pack_end(GTK_BOX(parent), gtkim->sep2, FALSE, TRUE, 0); | |
3213 gtk_widget_show(gtkim->sep2); | |
3214 | |
3215 /* Now, um, just kind of all over the place. Huh? */ | |
3216 | |
3217 /* Warn button */ | |
3218 gtkim->warn = gaim_gtk_change_text(_("Warn"), gtkim->warn, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3219 GAIM_STOCK_WARN, GAIM_CONV_IM); |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3220 gtk_tooltips_set_tip(gtkconv->tooltips, gtkim->warn, |
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3221 _("Warn the user"), NULL); |
7929 | 3222 gtk_box_pack_start(GTK_BOX(parent), gtkim->warn, FALSE, FALSE, 0); |
3223 | |
3224 /* Block button */ | |
3225 gtkim->block = gaim_gtk_change_text(_("Block"), gtkim->block, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3226 GAIM_STOCK_BLOCK, GAIM_CONV_IM); |
7929 | 3227 gtk_tooltips_set_tip(gtkconv->tooltips, gtkim->block, |
3228 _("Block the user"), NULL); | |
3229 gtk_box_pack_start(GTK_BOX(parent), gtkim->block, FALSE, FALSE, 0); | |
3230 | |
3231 /* Add button */ | |
3232 gtkconv->add = gaim_gtk_change_text(_("Add"), gtkconv->add, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3233 GTK_STOCK_ADD, GAIM_CONV_IM); |
7929 | 3234 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->add, |
3235 _("Add the user to your buddy list"), NULL); | |
3236 gtk_box_pack_start(GTK_BOX(parent), gtkconv->add, FALSE, FALSE, 0); | |
3237 | |
3238 /* Remove button */ | |
3239 gtkconv->remove = gaim_gtk_change_text(_("Remove"), gtkconv->remove, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3240 GTK_STOCK_REMOVE, GAIM_CONV_IM); |
7929 | 3241 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->remove, |
3242 _("Remove the user from your buddy list"), NULL); | |
3243 gtk_box_pack_start(GTK_BOX(parent), gtkconv->remove, FALSE, FALSE, 0); | |
4359 | 3244 |
3245 /* Info button */ | |
3246 gtkconv->info = gaim_gtk_change_text(_("Info"), gtkconv->info, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3247 GAIM_STOCK_INFO, GAIM_CONV_IM); |
4359 | 3248 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->info, |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3249 _("Get the user's information"), NULL); |
7929 | 3250 gtk_box_pack_start(GTK_BOX(parent), gtkconv->info, FALSE, FALSE, 0); |
3251 | |
3252 gtk_button_set_relief(GTK_BUTTON(gtkim->warn), GTK_RELIEF_NONE); | |
3253 gtk_button_set_relief(GTK_BUTTON(gtkim->block), GTK_RELIEF_NONE); | |
3254 gtk_button_set_relief(GTK_BUTTON(gtkconv->add), GTK_RELIEF_NONE); | |
3255 gtk_button_set_relief(GTK_BUTTON(gtkconv->remove), GTK_RELIEF_NONE); | |
4359 | 3256 gtk_button_set_relief(GTK_BUTTON(gtkconv->info), GTK_RELIEF_NONE); |
3257 gtk_button_set_relief(GTK_BUTTON(gtkconv->send), GTK_RELIEF_NONE); | |
7929 | 3258 |
3259 gtk_size_group_add_widget(gtkconv->sg, gtkim->warn); | |
3260 gtk_size_group_add_widget(gtkconv->sg, gtkim->block); | |
3261 gtk_size_group_add_widget(gtkconv->sg, gtkconv->add); | |
3262 gtk_size_group_add_widget(gtkconv->sg, gtkconv->remove); | |
4359 | 3263 gtk_size_group_add_widget(gtkconv->sg, gtkconv->info); |
3264 gtk_size_group_add_widget(gtkconv->sg, gtkconv->send); | |
7929 | 3265 |
3266 gtk_box_reorder_child(GTK_BOX(parent), gtkim->warn, 1); | |
3267 gtk_box_reorder_child(GTK_BOX(parent), gtkim->block, 2); | |
3268 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->add, 3); | |
3269 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->remove, 4); | |
3270 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->info, 5); | |
4359 | 3271 |
3272 gaim_gtkconv_update_buttons_by_protocol(conv); | |
3273 | |
3274 g_signal_connect(G_OBJECT(gtkim->warn), "clicked", | |
3275 G_CALLBACK(warn_cb), conv); | |
3276 g_signal_connect(G_OBJECT(gtkim->block), "clicked", | |
3277 G_CALLBACK(block_cb), conv); | |
7929 | 3278 g_signal_connect(G_OBJECT(gtkconv->add), "clicked", |
3279 G_CALLBACK(add_remove_cb), conv); | |
3280 g_signal_connect(G_OBJECT(gtkconv->remove), "clicked", | |
3281 G_CALLBACK(add_remove_cb), conv); | |
3282 g_signal_connect(G_OBJECT(gtkconv->info), "clicked", | |
3283 G_CALLBACK(info_cb), conv); | |
3284 g_signal_connect(G_OBJECT(gtkconv->send), "clicked", | |
3285 G_CALLBACK(send_cb), conv); | |
4359 | 3286 } |
3287 | |
3288 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3289 setup_chat_buttons(GaimConversation *conv, GtkWidget *parent) |
4359 | 3290 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3291 GaimConnection *gc; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3292 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3293 GaimGtkChatPane *gtkchat; |
4359 | 3294 |
3295 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3296 gtkchat = gtkconv->u.chat; | |
3297 gc = gaim_conversation_get_gc(conv); | |
3298 | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3299 /* From right to left... */ |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3300 |
4359 | 3301 /* Send button */ |
3302 gtkconv->send = gaim_gtk_change_text(_("Send"), gtkconv->send, | |
3303 GAIM_STOCK_SEND, GAIM_CONV_CHAT); | |
3304 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->send, _("Send"), NULL); | |
3305 gtk_box_pack_end(GTK_BOX(parent), gtkconv->send, FALSE, FALSE, 0); | |
3306 | |
3307 /* Separator */ | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3308 if (gtkchat->sep != NULL) |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3309 gtk_widget_destroy(gtkchat->sep); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3310 |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3311 gtkchat->sep = gtk_vseparator_new(); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3312 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
|
3313 gtk_widget_show(gtkchat->sep); |
4359 | 3314 |
3315 /* Invite */ | |
3316 gtkchat->invite = gaim_gtk_change_text(_("Invite"), gtkchat->invite, | |
3317 GAIM_STOCK_INVITE, GAIM_CONV_CHAT); | |
3318 gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->invite, | |
3319 _("Invite a user"), NULL); | |
7931 | 3320 gtk_box_pack_start(GTK_BOX(parent), gtkchat->invite, FALSE, FALSE, 0); |
4359 | 3321 |
7929 | 3322 /* Add button */ |
3323 gtkconv->add = gaim_gtk_change_text(_("Add"), gtkconv->add, | |
3324 GTK_STOCK_ADD, GAIM_CONV_CHAT); | |
3325 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->add, | |
3326 _("Add the chat to your buddy list"), NULL); | |
3327 gtk_box_pack_start(GTK_BOX(parent), gtkconv->add, FALSE, FALSE, 0); | |
3328 | |
3329 /* Remove button */ | |
3330 gtkconv->remove = gaim_gtk_change_text(_("Remove"), gtkconv->remove, | |
3331 GTK_STOCK_REMOVE, GAIM_CONV_CHAT); | |
3332 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->remove, | |
3333 _("Remove the chat from your buddy list"), NULL); | |
3334 gtk_box_pack_start(GTK_BOX(parent), gtkconv->remove, FALSE, FALSE, 0); | |
3335 | |
4359 | 3336 /* Set the relief on these. */ |
3337 gtk_button_set_relief(GTK_BUTTON(gtkchat->invite), GTK_RELIEF_NONE); | |
7929 | 3338 gtk_button_set_relief(GTK_BUTTON(gtkconv->add), GTK_RELIEF_NONE); |
3339 gtk_button_set_relief(GTK_BUTTON(gtkconv->remove), GTK_RELIEF_NONE); | |
4359 | 3340 gtk_button_set_relief(GTK_BUTTON(gtkconv->send), GTK_RELIEF_NONE); |
3341 | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3342 gtk_size_group_add_widget(gtkconv->sg, gtkchat->invite); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3343 gtk_size_group_add_widget(gtkconv->sg, gtkconv->add); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3344 gtk_size_group_add_widget(gtkconv->sg, gtkconv->remove); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3345 gtk_size_group_add_widget(gtkconv->sg, gtkconv->send); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3346 |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3347 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->add, 1); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3348 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->remove, 3); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3349 gtk_box_reorder_child(GTK_BOX(parent), gtkchat->invite, 3); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3350 |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3351 gaim_gtkconv_update_buttons_by_protocol(conv); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3352 |
4359 | 3353 /* Callbacks */ |
7929 | 3354 g_signal_connect(G_OBJECT(gtkchat->invite), "clicked", |
3355 G_CALLBACK(invite_cb), conv); | |
3356 g_signal_connect(G_OBJECT(gtkconv->add), "clicked", | |
3357 G_CALLBACK(add_remove_cb), conv); | |
3358 g_signal_connect(G_OBJECT(gtkconv->remove), "clicked", | |
3359 G_CALLBACK(add_remove_cb), conv); | |
4359 | 3360 g_signal_connect(G_OBJECT(gtkconv->send), "clicked", |
3361 G_CALLBACK(send_cb), conv); | |
3362 } | |
3363 | |
3364 static GtkWidget * | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3365 build_conv_toolbar(GaimConversation *conv) |
4359 | 3366 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3367 GaimGtkConversation *gtkconv; |
4359 | 3368 GtkWidget *vbox; |
3369 GtkWidget *hbox; | |
3370 GtkWidget *button; | |
3371 GtkWidget *sep; | |
3372 GtkSizeGroup *sg; | |
3373 | |
3374 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3375 | |
3376 sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); | |
3377 | |
3378 vbox = gtk_vbox_new(FALSE, 0); | |
3379 sep = gtk_hseparator_new(); | |
3380 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); | |
3381 | |
3382 hbox = gtk_hbox_new(FALSE, 5); | |
3383 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
3384 | |
3385 /* Bold */ | |
3386 button = gaim_pixbuf_toolbar_button_from_stock(GTK_STOCK_BOLD); | |
3387 gtk_size_group_add_widget(sg, button); | |
3388 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3389 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("Bold"), NULL); | |
3390 | |
3391 g_signal_connect(G_OBJECT(button), "clicked", | |
3392 G_CALLBACK(do_bold), gtkconv); | |
3393 | |
3394 gtkconv->toolbar.bold = button; | |
3395 | |
3396 /* Italic */ | |
3397 button = gaim_pixbuf_toolbar_button_from_stock(GTK_STOCK_ITALIC); | |
3398 gtk_size_group_add_widget(sg, button); | |
3399 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3400 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("Italic"), NULL); | |
3401 | |
3402 g_signal_connect(G_OBJECT(button), "clicked", | |
3403 G_CALLBACK(do_italic), gtkconv); | |
3404 | |
3405 gtkconv->toolbar.italic = button; | |
3406 | |
3407 /* Underline */ | |
3408 button = gaim_pixbuf_toolbar_button_from_stock(GTK_STOCK_UNDERLINE); | |
3409 gtk_size_group_add_widget(sg, button); | |
3410 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3411 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("Underline"), NULL); | |
3412 | |
3413 g_signal_connect(G_OBJECT(button), "clicked", | |
3414 G_CALLBACK(do_underline), gtkconv); | |
3415 | |
3416 gtkconv->toolbar.underline = button; | |
3417 | |
3418 /* Sep */ | |
3419 sep = gtk_vseparator_new(); | |
3420 gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 0); | |
3421 | |
3422 /* Increase font size */ | |
3423 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_TEXT_BIGGER); | |
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 _("Larger font size"), NULL); | |
3428 | |
3429 g_signal_connect(G_OBJECT(button), "clicked", | |
3430 G_CALLBACK(do_big), gtkconv); | |
3431 | |
5049 | 3432 gtkconv->toolbar.larger_size = button; |
3433 | |
7988 | 3434 /* Normal font size */ |
4359 | 3435 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_TEXT_NORMAL); |
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 _("Normal font size"), NULL); | |
3440 | |
3441 g_signal_connect(G_OBJECT(button), "clicked", | |
3442 G_CALLBACK(do_normal), gtkconv); | |
3443 | |
3444 gtkconv->toolbar.normal_size = button; | |
3445 | |
3446 /* Decrease font size */ | |
3447 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_TEXT_SMALLER); | |
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 _("Smaller font size"), NULL); | |
3452 | |
3453 g_signal_connect(G_OBJECT(button), "clicked", | |
3454 G_CALLBACK(do_small), gtkconv); | |
3455 | |
5049 | 3456 gtkconv->toolbar.smaller_size = button; |
3457 | |
4359 | 3458 /* Sep */ |
3459 sep = gtk_vseparator_new(); | |
3460 gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 0); | |
3461 | |
4685 | 3462 /* Font Face */ |
3463 | |
3464 button = gaim_pixbuf_toolbar_button_from_stock(GTK_STOCK_SELECT_FONT); | |
3465 gtk_size_group_add_widget(sg, button); | |
3466 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3467 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
3468 _("Font Face"), NULL); | |
3469 | |
3470 g_signal_connect(G_OBJECT(button), "clicked", | |
3471 G_CALLBACK(toggle_font), conv); | |
3472 | |
3473 gtkconv->toolbar.font = button; | |
3474 | |
4359 | 3475 /* Foreground Color */ |
3476 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_FGCOLOR); | |
3477 gtk_size_group_add_widget(sg, button); | |
3478 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3479 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
3480 _("Foreground font color"), NULL); | |
3481 | |
3482 g_signal_connect(G_OBJECT(button), "clicked", | |
3483 G_CALLBACK(toggle_fg_color), conv); | |
3484 | |
3485 gtkconv->toolbar.fgcolor = button; | |
3486 | |
3487 /* Background Color */ | |
3488 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_BGCOLOR); | |
3489 gtk_size_group_add_widget(sg, button); | |
3490 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3491 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
3492 _("Background color"), NULL); | |
3493 | |
3494 g_signal_connect(G_OBJECT(button), "clicked", | |
3495 G_CALLBACK(toggle_bg_color), conv); | |
3496 | |
3497 gtkconv->toolbar.bgcolor = button; | |
3498 | |
3499 /* Sep */ | |
3500 sep = gtk_vseparator_new(); | |
3501 gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 0); | |
3502 | |
7927 | 3503 /* Insert Link */ |
3504 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_LINK); | |
3505 gtk_size_group_add_widget(sg, button); | |
3506 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3507 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("Insert link"), NULL); | |
3508 | |
3509 g_signal_connect(G_OBJECT(button), "clicked", | |
3510 G_CALLBACK(insert_link_cb), conv); | |
3511 | |
3512 gtkconv->toolbar.link = button; | |
3513 | |
4359 | 3514 /* Insert IM Image */ |
3515 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_IMAGE); | |
3516 gtk_size_group_add_widget(sg, button); | |
3517 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3518 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("Insert image"), NULL); | |
3519 | |
3520 g_signal_connect(G_OBJECT(button), "clicked", | |
3521 G_CALLBACK(insert_image_cb), conv); | |
3522 | |
3523 gtkconv->toolbar.image = button; | |
3524 | |
3525 /* Insert Smiley */ | |
3526 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_SMILEY); | |
3527 gtk_size_group_add_widget(sg, button); | |
3528 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3529 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("Insert smiley"), NULL); | |
3530 | |
3531 g_signal_connect(G_OBJECT(button), "clicked", | |
3532 G_CALLBACK(insert_smiley_cb), conv); | |
3533 | |
3534 gtkconv->toolbar.smiley = button; | |
3535 | |
3536 | |
3537 sep = gtk_hseparator_new(); | |
3538 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); | |
3539 | |
3540 gtk_widget_show_all(vbox); | |
3541 | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3542 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/show_formatting_toolbar")) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3543 gtk_widget_hide(vbox); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3544 |
4359 | 3545 return vbox; |
3546 } | |
3547 | |
7971 | 3548 static void topic_callback(GtkWidget *w, GaimConversation *conv) |
3549 { | |
3550 GaimPluginProtocolInfo *prpl_info = NULL; | |
3551 GaimConnection *gc; | |
3552 GaimGtkConversation *gtkconv; | |
3553 GaimGtkChatPane *gtkchat; | |
3554 const char *topic; | |
3555 | |
3556 gc = gaim_conversation_get_gc(conv); | |
3557 | |
3558 if(!gc || !(prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl))) | |
3559 return; | |
3560 | |
3561 if(prpl_info->set_chat_topic == NULL) | |
3562 return; | |
3563 | |
3564 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3565 gtkchat = gtkconv->u.chat; | |
3566 topic = gtk_entry_get_text(GTK_ENTRY(gtkchat->topic_text)); | |
3567 | |
3568 if(!g_utf8_collate(topic, gaim_conv_chat_get_topic(GAIM_CONV_CHAT(conv)))) | |
3569 return; | |
3570 | |
3571 prpl_info->set_chat_topic(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), topic); | |
3572 } | |
3573 | |
4359 | 3574 static GtkWidget * |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3575 setup_chat_pane(GaimConversation *conv) |
4359 | 3576 { |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3577 GaimPluginProtocolInfo *prpl_info = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3578 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3579 GaimGtkChatPane *gtkchat; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3580 GaimConnection *gc; |
4359 | 3581 GtkWidget *vpaned, *hpaned; |
3582 GtkWidget *vbox, *hbox; | |
3583 GtkWidget *lbox, *bbox; | |
3584 GtkWidget *label; | |
3585 GtkWidget *list; | |
3586 GtkWidget *button; | |
7949 | 3587 GtkWidget *sw; |
4359 | 3588 GtkListStore *ls; |
3589 GtkCellRenderer *rend; | |
3590 GtkTreeViewColumn *col; | |
3591 | |
3592 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3593 gtkchat = gtkconv->u.chat; | |
3594 gc = gaim_conversation_get_gc(conv); | |
3595 | |
3596 /* Setup the outer pane. */ | |
3597 vpaned = gtk_vpaned_new(); | |
3598 gtk_widget_show(vpaned); | |
3599 | |
3600 /* Setup the top part of the pane. */ | |
3601 vbox = gtk_vbox_new(FALSE, 5); | |
3602 gtk_paned_pack1(GTK_PANED(vpaned), vbox, TRUE, FALSE); | |
3603 gtk_widget_show(vbox); | |
3604 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3605 if (gc != NULL) |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3606 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3607 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3608 if (prpl_info->options & OPT_PROTO_CHAT_TOPIC) |
4359 | 3609 { |
3610 hbox = gtk_hbox_new(FALSE, 0); | |
3611 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
3612 gtk_widget_show(hbox); | |
3613 | |
3614 label = gtk_label_new(_("Topic:")); | |
3615 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
3616 gtk_widget_show(label); | |
3617 | |
3618 gtkchat->topic_text = gtk_entry_new(); | |
7971 | 3619 if(prpl_info->set_chat_topic == NULL) { |
3620 gtk_editable_set_editable(GTK_EDITABLE(gtkchat->topic_text), FALSE); | |
3621 } else { | |
3622 g_signal_connect(GTK_OBJECT(gtkchat->topic_text), "activate", | |
3623 G_CALLBACK(topic_callback), conv); | |
3624 } | |
3625 | |
4359 | 3626 gtk_box_pack_start(GTK_BOX(hbox), gtkchat->topic_text, TRUE, TRUE, 5); |
3627 gtk_widget_show(gtkchat->topic_text); | |
3628 } | |
3629 | |
3630 /* Setup the horizontal pane. */ | |
3631 hpaned = gtk_hpaned_new(); | |
3632 gtk_box_pack_start(GTK_BOX(vbox), hpaned, TRUE, TRUE, 5); | |
3633 gtk_widget_show(hpaned); | |
3634 | |
3635 /* Setup the scrolled window to put gtkimhtml in. */ | |
3636 gtkconv->sw = gtk_scrolled_window_new(NULL, NULL); | |
3637 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
3638 GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); | |
3639 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
3640 GTK_SHADOW_IN); | |
3641 gtk_paned_pack1(GTK_PANED(hpaned), gtkconv->sw, TRUE, TRUE); | |
3642 | |
3643 gtk_widget_set_size_request(gtkconv->sw, | |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3644 gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_width"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3645 gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_height")); |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3646 |
4359 | 3647 gtk_widget_show(gtkconv->sw); |
3648 | |
3649 /* Setup gtkihmtml. */ | |
3650 gtkconv->imhtml = gtk_imhtml_new(NULL, NULL); | |
3651 gtk_container_add(GTK_CONTAINER(gtkconv->sw), gtkconv->imhtml); | |
3652 | |
3653 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3654 gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); |
4359 | 3655 |
3656 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", | |
3657 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
6057 | 3658 g_signal_connect(G_OBJECT(gtkconv->imhtml), "button_release_event", |
3659 G_CALLBACK(refocus_entry_cb), gtkconv); | |
4359 | 3660 |
3661 gaim_setup_imhtml(gtkconv->imhtml); | |
3662 | |
3663 gtk_widget_show(gtkconv->imhtml); | |
3664 | |
3665 /* Build the right pane. */ | |
3666 lbox = gtk_vbox_new(FALSE, 5); | |
4409
0521eec12c33
[gaim-migrate @ 4682]
Christian Hammond <chipx86@chipx86.com>
parents:
4398
diff
changeset
|
3667 gtk_paned_pack2(GTK_PANED(hpaned), lbox, FALSE, TRUE); |
4359 | 3668 gtk_widget_show(lbox); |
3669 | |
3670 /* Setup the label telling how many people are in the room. */ | |
3671 gtkchat->count = gtk_label_new(_("0 people in room")); | |
3672 gtk_box_pack_start(GTK_BOX(lbox), gtkchat->count, FALSE, FALSE, 0); | |
3673 gtk_widget_show(gtkchat->count); | |
3674 | |
3675 /* Setup the list of users. */ | |
7949 | 3676 sw = gtk_scrolled_window_new(NULL, NULL); |
3677 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
4359 | 3678 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); |
7949 | 3679 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); |
3680 gtk_box_pack_start(GTK_BOX(lbox), sw, TRUE, TRUE, 0); | |
3681 gtk_widget_show(sw); | |
4359 | 3682 |
3683 ls = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING); | |
3684 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), 1, | |
3685 GTK_SORT_ASCENDING); | |
3686 | |
3687 list = gtk_tree_view_new_with_model(GTK_TREE_MODEL(ls)); | |
3688 | |
3689 rend = gtk_cell_renderer_text_new(); | |
3690 col = gtk_tree_view_column_new_with_attributes(NULL, rend, | |
3691 "text", 0, NULL); | |
3692 gtk_tree_view_column_set_clickable(GTK_TREE_VIEW_COLUMN(col), TRUE); | |
3693 | |
3694 g_signal_connect(G_OBJECT(list), "button_press_event", | |
3695 G_CALLBACK(right_click_chat_cb), conv); | |
3696 | |
3697 gtk_tree_view_append_column(GTK_TREE_VIEW(list), col); | |
3698 | |
3699 col = gtk_tree_view_column_new_with_attributes(NULL, rend, | |
3700 "text", 1, NULL); | |
3701 gtk_tree_view_column_set_clickable(GTK_TREE_VIEW_COLUMN(col), TRUE); | |
3702 | |
3703 gtk_tree_view_append_column(GTK_TREE_VIEW(list), col); | |
3704 | |
3705 gtk_widget_set_size_request(list, 150, -1); | |
3706 | |
3707 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(list), FALSE); | |
3708 gtk_widget_show(list); | |
3709 | |
3710 gtkchat->list = list; | |
3711 | |
7949 | 3712 gtk_container_add(GTK_CONTAINER(sw), list); |
4359 | 3713 |
3714 /* Setup the user list toolbar. */ | |
3715 bbox = gtk_hbox_new(TRUE, 5); | |
3716 gtk_box_pack_start(GTK_BOX(lbox), bbox, FALSE, FALSE, 0); | |
3717 gtk_widget_show(bbox); | |
3718 | |
3719 /* IM */ | |
3720 button = gaim_pixbuf_button_from_stock(NULL, GTK_STOCK_REDO, | |
3721 GAIM_BUTTON_VERTICAL); | |
3722 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
3723 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
|
3724 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("IM the user"), NULL); |
4359 | 3725 g_signal_connect(G_OBJECT(button), "clicked", |
7961 | 3726 G_CALLBACK(chat_im_button_cb), conv); |
4359 | 3727 |
3728 gtk_widget_show(button); | |
3729 | |
3730 /* Ignore */ | |
3731 button = gaim_pixbuf_button_from_stock(NULL, GAIM_STOCK_IGNORE, | |
3732 GAIM_BUTTON_VERTICAL); | |
3733 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
3734 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
|
3735 gtk_tooltips_set_tip(gtkconv->tooltips, button, |
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3736 _("Ignore the user"), NULL); |
4359 | 3737 g_signal_connect(G_OBJECT(button), "clicked", |
3738 G_CALLBACK(ignore_cb), conv); | |
3739 gtk_widget_show(button); | |
3740 | |
3741 /* Info */ | |
3742 button = gaim_pixbuf_button_from_stock(NULL, GAIM_STOCK_INFO, | |
3743 GAIM_BUTTON_VERTICAL); | |
3744 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
3745 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
3746 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3747 _("Get the user's information"), NULL); |
4359 | 3748 g_signal_connect(G_OBJECT(button), "clicked", |
3749 G_CALLBACK(info_cb), conv); | |
3750 | |
3751 gtk_widget_show(button); | |
3752 | |
3753 gtkconv->info = button; | |
3754 | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3755 /* Build the toolbar. */ |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3756 vbox = gtk_vbox_new(FALSE, 5); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3757 gtk_paned_pack2(GTK_PANED(vpaned), vbox, FALSE, FALSE); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3758 gtk_widget_show(vbox); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3759 |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3760 gtkconv->toolbar.toolbar = build_conv_toolbar(conv); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3761 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->toolbar.toolbar, |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3762 FALSE, FALSE, 0); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3763 |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3764 /* Setup the entry widget. */ |
7949 | 3765 sw = gtk_scrolled_window_new(NULL, NULL); |
3766 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
7988 | 3767 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
3768 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); | |
7949 | 3769 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); |
3770 gtk_widget_show(sw); | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3771 |
7988 | 3772 gtkconv->entry_buffer = gtk_text_buffer_new(NULL); |
3773 gtkconv->entry = gtk_text_view_new_with_buffer(gtkconv->entry_buffer); | |
3774 | |
5105 | 3775 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
|
3776 gtk_widget_set_size_request(gtkconv->entry, -1, |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3777 MAX(gaim_prefs_get_int("/gaim/gtk/conversations/chat/entry_height"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3778 25)); |
7949 | 3779 g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", conv); |
3780 | |
4359 | 3781 g_signal_connect_swapped(G_OBJECT(gtkconv->entry), "key_press_event", |
3782 G_CALLBACK(entry_key_pressed_cb_1), | |
3783 gtkconv->entry_buffer); | |
7949 | 3784 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", |
3785 G_CALLBACK(entry_key_pressed_cb_2), conv); | |
4359 | 3786 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", |
3787 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
3788 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3789 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
3790 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
4359 | 3791 |
7949 | 3792 gtk_container_add(GTK_CONTAINER(sw), GTK_WIDGET(gtkconv->entry)); |
4359 | 3793 gtk_widget_show(gtkconv->entry); |
3794 | |
3795 /* Setup the bottom button box. */ | |
3796 gtkconv->bbox = gtk_hbox_new(FALSE, 5); | |
3797 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->bbox, FALSE, FALSE, 0); | |
3798 gtk_widget_show(gtkconv->bbox); | |
3799 | |
3800 setup_chat_buttons(conv, gtkconv->bbox); | |
3801 | |
3802 return vpaned; | |
3803 } | |
3804 | |
3805 static GtkWidget * | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3806 setup_im_pane(GaimConversation *conv) |
4359 | 3807 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3808 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3809 GaimGtkImPane *gtkim; |
4359 | 3810 GtkWidget *paned; |
3811 GtkWidget *vbox; | |
3812 GtkWidget *vbox2; | |
7949 | 3813 GtkWidget *sw; |
4359 | 3814 |
3815 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3816 gtkim = gtkconv->u.im; | |
3817 | |
3818 /* Setup the outer pane. */ | |
3819 paned = gtk_vpaned_new(); | |
3820 gtk_widget_show(paned); | |
3821 | |
3822 /* Setup the top part of the pane. */ | |
3823 vbox = gtk_vbox_new(FALSE, 5); | |
4409
0521eec12c33
[gaim-migrate @ 4682]
Christian Hammond <chipx86@chipx86.com>
parents:
4398
diff
changeset
|
3824 gtk_paned_pack1(GTK_PANED(paned), vbox, TRUE, TRUE); |
4359 | 3825 gtk_widget_show(vbox); |
3826 | |
3827 /* Setup the gtkimhtml widget. */ | |
3828 gtkconv->sw = gtk_scrolled_window_new(NULL, NULL); | |
3829 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
3830 GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); | |
3831 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
3832 GTK_SHADOW_IN); | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3833 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->sw, TRUE, TRUE, 0); |
4851 | 3834 |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3835 gtk_widget_set_size_request(gtkconv->sw, |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3836 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_width"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3837 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_height")); |
4359 | 3838 gtk_widget_show(gtkconv->sw); |
3839 | |
3840 gtkconv->imhtml = gtk_imhtml_new(NULL, NULL); | |
3841 gtk_container_add(GTK_CONTAINER(gtkconv->sw), gtkconv->imhtml); | |
3842 | |
3843 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", | |
3844 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
6057 | 3845 g_signal_connect(G_OBJECT(gtkconv->imhtml), "button_release_event", |
3846 G_CALLBACK(refocus_entry_cb), gtkconv); | |
4359 | 3847 |
3848 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3849 gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); |
4359 | 3850 |
3851 gaim_setup_imhtml(gtkconv->imhtml); | |
3852 gtk_widget_show(gtkconv->imhtml); | |
3853 | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3854 vbox2 = gtk_vbox_new(FALSE, 5); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3855 gtk_paned_pack2(GTK_PANED(paned), vbox2, FALSE, FALSE); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3856 gtk_widget_show(vbox2); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3857 |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3858 /* Build the toolbar. */ |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3859 gtkconv->toolbar.toolbar = build_conv_toolbar(conv); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3860 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->toolbar.toolbar, |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3861 FALSE, FALSE, 0); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3862 |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3863 /* Setup the entry widget. */ |
7949 | 3864 sw = gtk_scrolled_window_new(NULL, NULL); |
3865 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
7988 | 3866 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
3867 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); | |
7949 | 3868 gtk_box_pack_start(GTK_BOX(vbox2), sw, TRUE, TRUE, 0); |
3869 gtk_widget_show(sw); | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3870 |
7988 | 3871 gtkconv->entry_buffer = gtk_text_buffer_new(NULL); |
3872 gtkconv->entry = gtk_text_view_new_with_buffer(gtkconv->entry_buffer); | |
3873 | |
5105 | 3874 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
|
3875 gtk_widget_set_size_request(gtkconv->entry, -1, |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3876 MAX(gaim_prefs_get_int("/gaim/gtk/conversations/im/entry_height"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3877 25)); |
7949 | 3878 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
|
3879 |
4359 | 3880 g_signal_connect_swapped(G_OBJECT(gtkconv->entry), "key_press_event", |
3881 G_CALLBACK(entry_key_pressed_cb_1), | |
3882 gtkconv->entry_buffer); | |
3883 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", | |
3884 G_CALLBACK(entry_key_pressed_cb_2), conv); | |
3885 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", | |
3886 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
3887 | |
3888 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "insert_text", | |
3889 G_CALLBACK(insert_text_cb), conv); | |
3890 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "delete_range", | |
3891 G_CALLBACK(delete_text_cb), conv); | |
3892 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3893 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
3894 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
4359 | 3895 |
7949 | 3896 gtk_container_add(GTK_CONTAINER(sw), GTK_WIDGET(gtkconv->entry)); |
4359 | 3897 gtk_widget_show(gtkconv->entry); |
3898 | |
3899 gtkconv->bbox = gtk_hbox_new(FALSE, 5); | |
3900 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->bbox, FALSE, FALSE, 0); | |
3901 gtk_widget_show(gtkconv->bbox); | |
3902 | |
3903 setup_im_buttons(conv, gtkconv->bbox); | |
3904 | |
3905 return paned; | |
3906 } | |
3907 | |
3908 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3909 move_next_tab(GaimConversation *conv) |
4359 | 3910 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3911 GaimConversation *next_conv = NULL; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3912 GaimConvWindow *win; |
4359 | 3913 GList *l; |
3914 int index, i; | |
3915 | |
3916 win = gaim_conversation_get_window(conv); | |
3917 index = gaim_conversation_get_index(conv); | |
3918 | |
3919 /* First check the tabs after this position. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3920 for (l = g_list_nth(gaim_conv_window_get_conversations(win), index); |
4359 | 3921 l != NULL; |
3922 l = l->next) { | |
3923 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3924 next_conv = (GaimConversation *)l->data; |
4359 | 3925 |
3926 if (gaim_conversation_get_unseen(next_conv) > 0) | |
3927 break; | |
3928 | |
3929 next_conv = NULL; | |
3930 } | |
3931 | |
3932 if (next_conv == NULL) { | |
3933 | |
3934 /* Now check before this position. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3935 for (l = gaim_conv_window_get_conversations(win), i = 0; |
4359 | 3936 l != NULL && i < index; |
3937 l = l->next) { | |
3938 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3939 next_conv = (GaimConversation *)l->data; |
4359 | 3940 |
3941 if (gaim_conversation_get_unseen(next_conv) > 0) | |
3942 break; | |
3943 | |
3944 next_conv = NULL; | |
3945 } | |
3946 | |
3947 if (next_conv == NULL) { | |
3948 /* Okay, just grab the next conversation tab. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3949 if (index == gaim_conv_window_get_conversation_count(win) - 1) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3950 next_conv = gaim_conv_window_get_conversation_at(win, 0); |
4359 | 3951 else |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3952 next_conv = gaim_conv_window_get_conversation_at(win, index + 1); |
4359 | 3953 } |
3954 } | |
3955 | |
3956 if (next_conv != NULL && next_conv != conv) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3957 gaim_conv_window_switch_conversation(win, |
4359 | 3958 gaim_conversation_get_index(next_conv)); |
3959 } | |
3960 } | |
3961 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3962 static void |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3963 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
|
3964 GtkSelectionData *sd, guint info, guint t, |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3965 GaimConversation *conv) |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3966 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3967 GaimConvWindow *win = conv->window; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3968 GaimConversation *c; |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3969 |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3970 if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE)) |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3971 { |
4781 | 3972 GaimBlistNode *n = NULL; |
6695 | 3973 GaimBuddy *b; |
4781 | 3974 memcpy(&n, sd->data, sizeof(n)); |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3975 |
6695 | 3976 if (GAIM_BLIST_NODE_IS_CONTACT(n)) |
3977 b = gaim_contact_get_priority_buddy((GaimContact*)n); | |
3978 else if (GAIM_BLIST_NODE_IS_BUDDY(n)) | |
3979 b = (GaimBuddy*)n; | |
3980 else | |
4781 | 3981 return; |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
3982 |
7089
2cd3756a637b
[gaim-migrate @ 7654]
Christian Hammond <chipx86@chipx86.com>
parents:
7078
diff
changeset
|
3983 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
|
3984 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3985 gaim_conv_window_add_conversation(win, c); |
4702 | 3986 } |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3987 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
|
3988 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3989 char *protocol = NULL; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3990 char *username = NULL; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3991 GaimAccount *account; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3992 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3993 if (gaim_gtk_parse_x_im_contact(sd->data, FALSE, &account, |
7718 | 3994 &protocol, &username, NULL)) |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3995 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3996 if (account == NULL) |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3997 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3998 gaim_notify_error(NULL, NULL, |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
3999 _("You are not currently signed on with an account that " |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4000 "can add that buddy."), NULL); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4001 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4002 else |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4003 { |
7718 | 4004 c = gaim_conversation_new(GAIM_CONV_IM, account, username); |
4005 gaim_conv_window_add_conversation(win, c); | |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4006 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4007 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4008 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4009 if (username != NULL) g_free(username); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4010 if (protocol != NULL) g_free(protocol); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4011 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4012 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4013 } |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4014 } |
4359 | 4015 |
4016 /************************************************************************** | |
4017 * GTK+ window ops | |
4018 **************************************************************************/ | |
4019 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4020 gaim_gtk_new_window(GaimConvWindow *win) |
4359 | 4021 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4022 GaimGtkWindow *gtkwin; |
4359 | 4023 GtkPositionType pos; |
4024 GtkWidget *testidea; | |
4025 GtkWidget *menubar; | |
4026 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4027 gtkwin = g_malloc0(sizeof(GaimGtkWindow)); |
4359 | 4028 |
4029 win->ui_data = gtkwin; | |
4030 | |
4031 /* Create the window. */ | |
4032 gtkwin->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
4033 gtk_window_set_role(GTK_WINDOW(gtkwin->window), "conversation"); | |
4635 | 4034 gtk_window_set_resizable(GTK_WINDOW(gtkwin->window), TRUE); |
4510
4c394222c732
[gaim-migrate @ 4786]
Christian Hammond <chipx86@chipx86.com>
parents:
4505
diff
changeset
|
4035 gtk_container_set_border_width(GTK_CONTAINER(gtkwin->window), 0); |
5173 | 4036 GTK_WINDOW(gtkwin->window)->allow_shrink = TRUE; |
4359 | 4037 gtk_widget_realize(gtkwin->window); |
4038 | |
4039 g_signal_connect(G_OBJECT(gtkwin->window), "delete_event", | |
4040 G_CALLBACK(close_win_cb), win); | |
4041 | |
4042 /* Create the notebook. */ | |
4043 gtkwin->notebook = gtk_notebook_new(); | |
4044 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4045 pos = gaim_prefs_get_int("/gaim/gtk/conversations/tab_side"); |
4359 | 4046 |
4047 #if 0 | |
4048 gtk_notebook_set_tab_hborder(GTK_NOTEBOOK(gtkwin->notebook), 0); | |
4049 gtk_notebook_set_tab_vborder(GTK_NOTEBOOK(gtkwin->notebook), 0); | |
4050 #endif | |
4051 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos); | |
4052 gtk_notebook_set_scrollable(GTK_NOTEBOOK(gtkwin->notebook), TRUE); | |
4053 gtk_notebook_popup_enable(GTK_NOTEBOOK(gtkwin->notebook)); | |
4818 | 4054 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), FALSE); |
4055 | |
4359 | 4056 gtk_widget_show(gtkwin->notebook); |
4057 | |
4058 g_signal_connect_after(G_OBJECT(gtkwin->notebook), "switch_page", | |
4059 G_CALLBACK(switch_conv_cb), win); | |
4060 | |
4061 /* Setup the tab drag and drop signals. */ | |
4486 | 4062 gtk_widget_add_events(gtkwin->notebook, |
4063 GDK_BUTTON1_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK); | |
4064 g_signal_connect(G_OBJECT(gtkwin->notebook), "button_press_event", | |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4065 G_CALLBACK(notebook_press_cb), win); |
4486 | 4066 g_signal_connect(G_OBJECT(gtkwin->notebook), "button_release_event", |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4067 G_CALLBACK(notebook_release_cb), win); |
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4068 |
4359 | 4069 testidea = gtk_vbox_new(FALSE, 0); |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4070 |
4359 | 4071 /* Setup the menubar. */ |
4072 menubar = setup_menubar(win); | |
4073 gtk_box_pack_start(GTK_BOX(testidea), menubar, FALSE, TRUE, 0); | |
4074 | |
4075 gtk_box_pack_start(GTK_BOX(testidea), gtkwin->notebook, TRUE, TRUE, 0); | |
4076 | |
4077 gtk_container_add(GTK_CONTAINER(gtkwin->window), testidea); | |
4078 | |
4079 gtk_widget_show(testidea); | |
4080 } | |
4081 | |
4082 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4083 gaim_gtk_destroy_window(GaimConvWindow *win) |
4359 | 4084 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4085 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4086 |
4087 gtk_widget_destroy(gtkwin->window); | |
4088 | |
4630 | 4089 g_object_unref(G_OBJECT(gtkwin->menu.item_factory)); |
4090 | |
4359 | 4091 g_free(gtkwin); |
4092 win->ui_data = NULL; | |
4093 } | |
4094 | |
4095 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4096 gaim_gtk_show(GaimConvWindow *win) |
4359 | 4097 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4098 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4099 |
4100 gtk_widget_show(gtkwin->window); | |
7413 | 4101 |
4102 #ifdef _WIN32 | |
7415 | 4103 /* This works around a win32 gtk+ bug, where it can't handle |
4104 * creating the button correctly before the window is shown. | |
4105 * That's why we get the appearance of a button, without all | |
4106 * the normal button-like properties, like being able to click | |
7413 | 4107 * it. ;-) --Nathan */ |
7414 | 4108 if (gaim_prefs_get_bool("/gaim/gtk/conversations/close_on_tabs")) { |
4109 GaimConversation *conv; | |
4110 GaimGtkConversation *gtkconv; | |
4111 | |
4112 conv = gaim_conv_window_get_conversation_at(win, 0); | |
4113 if(conv) { | |
4114 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7415 | 4115 gtk_widget_hide(gtkconv->close); |
7414 | 4116 gtk_widget_show_all(gtkconv->close); |
4117 } | |
4118 } | |
7413 | 4119 #endif |
4359 | 4120 } |
4121 | |
4122 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4123 gaim_gtk_hide(GaimConvWindow *win) |
4359 | 4124 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4125 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4126 |
4127 gtk_widget_hide(gtkwin->window); | |
4128 } | |
4129 | |
4130 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4131 gaim_gtk_raise(GaimConvWindow *win) |
4359 | 4132 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4133 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4134 |
5484 | 4135 gtk_widget_show(gtkwin->window); |
5103 | 4136 gtk_window_deiconify(GTK_WINDOW(gtkwin->window)); |
4526 | 4137 gdk_window_raise(gtkwin->window->window); |
4359 | 4138 } |
4139 | |
4140 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4141 gaim_gtk_flash(GaimConvWindow *win) |
4359 | 4142 { |
4143 #ifdef _WIN32 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4144 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4145 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4146 wgaim_conv_im_blink(gtkwin->window); |
4359 | 4147 #endif |
4148 } | |
4149 | |
4150 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4151 gaim_gtk_switch_conversation(GaimConvWindow *win, unsigned int index) |
4359 | 4152 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4153 GaimGtkWindow *gtkwin; |
4359 | 4154 |
4155 gtkwin = GAIM_GTK_WINDOW(win); | |
4156 | |
4157 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), index); | |
4158 } | |
4159 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4160 static const GtkTargetEntry te[] = |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4161 { |
7695 | 4162 {"text/plain", 0, 0}, |
4163 {"text/uri-list", 0, 1}, | |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4164 {"GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, 2}, |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4165 {"STRING", 0, 3}, |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4166 {"application/x-im-contact", 0, 4} |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4167 }; |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4168 |
4359 | 4169 static void |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4170 gaim_gtk_add_conversation(GaimConvWindow *win, GaimConversation *conv) |
4359 | 4171 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4172 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4173 GaimGtkConversation *gtkconv, *focus_gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4174 GaimConversation *focus_conv; |
4359 | 4175 GtkWidget *pane = NULL; |
4176 GtkWidget *tab_cont; | |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4177 GtkWidget *tabby, *menu_tabby; |
4359 | 4178 gboolean new_ui; |
4383
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4179 GaimConversationType conv_type; |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4180 const char *name; |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4181 |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4182 name = gaim_conversation_get_name(conv); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4183 conv_type = gaim_conversation_get_type(conv); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4184 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4185 |
4186 if (conv->ui_data != NULL) { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4187 gtkconv = (GaimGtkConversation *)conv->ui_data; |
4359 | 4188 |
4189 tab_cont = gtkconv->tab_cont; | |
4190 | |
4191 new_ui = FALSE; | |
4192 } | |
4193 else { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4194 gtkconv = g_malloc0(sizeof(GaimGtkConversation)); |
4359 | 4195 conv->ui_data = gtkconv; |
4196 | |
4197 /* Setup some initial variables. */ | |
4198 gtkconv->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
4199 gtkconv->tooltips = gtk_tooltips_new(); | |
4200 | |
4421 | 4201 /* Setup the foreground and background colors */ |
4202 gaim_gtkconv_update_font_colors(conv); | |
4203 | |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
4204 /* Setup the font face */ |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
4205 gaim_gtkconv_update_font_face(conv); |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
4206 |
7879 | 4207 if (conv_type == GAIM_CONV_IM) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4208 gtkconv->u.im = g_malloc0(sizeof(GaimGtkImPane)); |
4359 | 4209 gtkconv->u.im->a_virgin = TRUE; |
4210 | |
4211 pane = setup_im_pane(conv); | |
4212 } | |
7879 | 4213 else if (conv_type == GAIM_CONV_CHAT) { |
4214 gtkconv->u.chat = g_malloc0(sizeof(GaimGtkChatPane)); | |
4215 | |
4216 pane = setup_chat_pane(conv); | |
4217 } | |
4359 | 4218 |
4219 if (pane == NULL) { | |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4220 if (conv_type == GAIM_CONV_CHAT) g_free(gtkconv->u.chat); |
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4221 else if (conv_type == GAIM_CONV_IM) g_free(gtkconv->u.im); |
4359 | 4222 |
4223 g_free(gtkconv); | |
4224 conv->ui_data = NULL; | |
4225 | |
4226 return; | |
4227 } | |
4228 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4229 /* Setup drag-and-drop */ |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4230 gtk_drag_dest_set(pane, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4231 GTK_DEST_DEFAULT_MOTION | |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4232 GTK_DEST_DEFAULT_DROP, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4233 te, sizeof(te) / sizeof(GtkTargetEntry), |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4234 GDK_ACTION_COPY); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4235 gtk_drag_dest_set(gtkconv->imhtml, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4236 GTK_DEST_DEFAULT_MOTION | |
4702 | 4237 GTK_DEST_DEFAULT_DROP, |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4238 te, sizeof(te) / sizeof(GtkTargetEntry), |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4239 GDK_ACTION_DEFAULT | GDK_ACTION_COPY | GDK_ACTION_MOVE); |
7695 | 4240 gtk_drag_dest_set(gtkconv->entry, |
4241 GTK_DEST_DEFAULT_MOTION | | |
4242 GTK_DEST_DEFAULT_DROP, | |
4243 te, sizeof(te) / sizeof(GtkTargetEntry), | |
4244 GDK_ACTION_COPY); | |
4245 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4246 g_signal_connect(G_OBJECT(pane), "drag_data_received", |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4247 G_CALLBACK(conv_dnd_recv), conv); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4248 g_signal_connect(G_OBJECT(gtkconv->imhtml), "drag_data_received", |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4249 G_CALLBACK(conv_dnd_recv), conv); |
7695 | 4250 #if 0 |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4251 g_signal_connect(G_OBJECT(gtkconv->entry), "drag_data_received", |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4252 G_CALLBACK(conv_dnd_recv), conv); |
7695 | 4253 #endif |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4254 |
4359 | 4255 /* Setup the container for the tab. */ |
4256 gtkconv->tab_cont = tab_cont = gtk_vbox_new(FALSE, 5); | |
4257 gtk_container_set_border_width(GTK_CONTAINER(tab_cont), 5); | |
4258 gtk_container_add(GTK_CONTAINER(tab_cont), pane); | |
4259 gtk_widget_show(pane); | |
4260 | |
4261 new_ui = TRUE; | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
4262 |
4359 | 4263 gtkconv->make_sound = TRUE; |
5902
6889b89cab90
[gaim-migrate @ 6334]
Christian Hammond <chipx86@chipx86.com>
parents:
5901
diff
changeset
|
4264 |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4265 gtkconv->show_formatting_toolbar = gaim_prefs_get_bool( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4266 "/gaim/gtk/conversations/show_formatting_toolbar"); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4267 |
5902
6889b89cab90
[gaim-migrate @ 6334]
Christian Hammond <chipx86@chipx86.com>
parents:
5901
diff
changeset
|
4268 g_signal_connect_swapped(G_OBJECT(pane), "focus", |
7143 | 4269 G_CALLBACK(gtk_widget_grab_focus), |
4270 gtkconv->entry); | |
4359 | 4271 } |
4272 | |
4273 gtkconv->tabby = tabby = gtk_hbox_new(FALSE, 5); | |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4274 gtkconv->menu_tabby = menu_tabby = gtk_hbox_new(FALSE, 5); |
4359 | 4275 |
4276 /* Close button. */ | |
4277 gtkconv->close = gtk_button_new(); | |
4278 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
|
4279 gtk_button_set_relief(GTK_BUTTON(gtkconv->close), GTK_RELIEF_NONE); |
4359 | 4280 gtk_container_add(GTK_CONTAINER(gtkconv->close), |
4445 | 4281 gtk_image_new_from_stock(GTK_STOCK_CLOSE, |
4282 GTK_ICON_SIZE_MENU)); | |
4359 | 4283 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->close, |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4284 _("Close conversation"), NULL); |
4359 | 4285 |
4286 g_signal_connect(G_OBJECT(gtkconv->close), "clicked", | |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4287 G_CALLBACK(close_conv_cb), conv); |
4359 | 4288 |
7446
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4289 /* |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4290 * 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
|
4291 * border bug. I love you guys! -- ChipX86 |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4292 */ |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4293 g_signal_connect(G_OBJECT(gtkconv->close), "state_changed", |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4294 G_CALLBACK(tab_close_button_state_changed_cb), NULL); |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4295 |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4296 /* Status icon. */ |
6440 | 4297 gtkconv->icon = gtk_image_new(); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4298 gtkconv->menu_icon = gtk_image_new(); |
6440 | 4299 update_tab_icon(conv); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4300 |
4359 | 4301 /* Tab label. */ |
4302 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
|
4303 gtkconv->menu_label = gtk_label_new(gaim_conversation_get_title(conv)); |
4359 | 4304 #if 0 |
4305 gtk_misc_set_alignment(GTK_MISC(gtkconv->tab_label), 0.00, 0.5); | |
4306 gtk_misc_set_padding(GTK_MISC(gtkconv->tab_label), 4, 0); | |
4307 #endif | |
4308 | |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
4309 |
4359 | 4310 /* Pack it all together. */ |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4311 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
|
4312 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
|
4313 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
|
4314 gtk_widget_show_all(gtkconv->icon); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4315 gtk_widget_show_all(gtkconv->menu_icon); |
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4316 } |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4317 |
4359 | 4318 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
|
4319 gtk_box_pack_start(GTK_BOX(menu_tabby), gtkconv->menu_label, TRUE, TRUE, 0); |
4445 | 4320 gtk_widget_show(gtkconv->tab_label); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4321 gtk_widget_show(gtkconv->menu_label); |
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4322 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
|
4323 |
4445 | 4324 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
|
4325 if (gaim_prefs_get_bool("/gaim/gtk/conversations/close_on_tabs")) |
4445 | 4326 gtk_widget_show_all(gtkconv->close); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4327 |
4445 | 4328 gtk_widget_show(tabby); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4329 gtk_widget_show(menu_tabby); |
4359 | 4330 |
7143 | 4331 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
4332 gaim_gtkconv_update_buddy_icon(conv); | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4333 |
4359 | 4334 /* Add this pane to the conversations notebook. */ |
4335 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
|
4336 gtk_notebook_set_menu_label(GTK_NOTEBOOK(gtkwin->notebook), tab_cont, menu_tabby); |
4359 | 4337 |
4338 gtk_widget_show(tab_cont); | |
4339 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4340 if (gaim_conv_window_get_conversation_count(win) == 1) { |
4818 | 4341 /* Er, bug in notebooks? Switch to the page manually. */ |
4359 | 4342 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), 0); |
4851 | 4343 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4344 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4345 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4346 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4347 else |
4818 | 4348 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), TRUE); |
4359 | 4349 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4350 focus_conv = g_list_nth_data(gaim_conv_window_get_conversations(win), |
5204 | 4351 gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook))); |
4352 focus_gtkconv = GAIM_GTK_CONVERSATION(focus_conv); | |
4353 gtk_widget_grab_focus(focus_gtkconv->entry); | |
4359 | 4354 |
4355 if (!new_ui) | |
4356 g_object_unref(gtkconv->tab_cont); | |
4357 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4358 if (gaim_conv_window_get_conversation_count(win) == 1) |
4685 | 4359 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); |
4359 | 4360 } |
4361 | |
4362 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4363 gaim_gtk_remove_conversation(GaimConvWindow *win, GaimConversation *conv) |
4359 | 4364 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4365 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4366 GaimGtkConversation *gtkconv; |
4359 | 4367 unsigned int index; |
4818 | 4368 GaimConversationType conv_type; |
4369 | |
4370 conv_type = gaim_conversation_get_type(conv); | |
4359 | 4371 index = gaim_conversation_get_index(conv); |
4372 | |
4373 gtkwin = GAIM_GTK_WINDOW(win); | |
4374 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4375 | |
4376 g_object_ref(gtkconv->tab_cont); | |
4377 gtk_object_sink(GTK_OBJECT(gtkconv->tab_cont)); | |
4378 | |
4379 gtk_notebook_remove_page(GTK_NOTEBOOK(gtkwin->notebook), index); | |
4380 | |
4818 | 4381 /* go back to tabless if need be */ |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4382 if (gaim_conv_window_get_conversation_count(win) <= 2) { |
4818 | 4383 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4384 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); |
4818 | 4385 } |
4386 | |
4387 | |
4359 | 4388 /* If this window is setup with an inactive gc, regenerate the menu. */ |
4818 | 4389 if (conv_type == GAIM_CONV_IM && |
4359 | 4390 gaim_conversation_get_gc(conv) == NULL) { |
4391 | |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
4392 generate_send_as_items(win, conv); |
4359 | 4393 } |
4394 } | |
4395 | |
4396 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4397 gaim_gtk_move_conversation(GaimConvWindow *win, GaimConversation *conv, |
4359 | 4398 unsigned int new_index) |
4399 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4400 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4401 GaimGtkConversation *gtkconv; |
4359 | 4402 |
4403 gtkwin = GAIM_GTK_WINDOW(win); | |
4404 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4405 | |
4415
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4406 if (new_index > gaim_conversation_get_index(conv)) |
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4407 new_index--; |
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4408 |
4359 | 4409 gtk_notebook_reorder_child(GTK_NOTEBOOK(gtkwin->notebook), |
4410 gtkconv->tab_cont, new_index); | |
4411 } | |
4412 | |
4413 static int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4414 gaim_gtk_get_active_index(const GaimConvWindow *win) |
4359 | 4415 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4416 GaimGtkWindow *gtkwin; |
5680
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4417 int index; |
4359 | 4418 |
4419 gtkwin = GAIM_GTK_WINDOW(win); | |
4420 | |
5680
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4421 index = gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook)); |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4422 |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4423 /* |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4424 * A fix, because the first conversation may be active, but not |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4425 * appear in the notebook just yet. -- ChipX86 |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4426 */ |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4427 return (index == -1 ? 0 : index); |
4359 | 4428 } |
4429 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4430 static GaimConvWindowUiOps window_ui_ops = |
4359 | 4431 { |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
4432 gaim_gtk_conversations_get_conv_ui_ops, |
4359 | 4433 gaim_gtk_new_window, |
4434 gaim_gtk_destroy_window, | |
4435 gaim_gtk_show, | |
4436 gaim_gtk_hide, | |
4437 gaim_gtk_raise, | |
4438 gaim_gtk_flash, | |
4439 gaim_gtk_switch_conversation, | |
4440 gaim_gtk_add_conversation, | |
4441 gaim_gtk_remove_conversation, | |
4442 gaim_gtk_move_conversation, | |
4443 gaim_gtk_get_active_index | |
4444 }; | |
4445 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4446 GaimConvWindowUiOps * |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
4447 gaim_gtk_conversations_get_win_ui_ops(void) |
4359 | 4448 { |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4449 return &window_ui_ops; |
4359 | 4450 } |
4451 | |
4452 /************************************************************************** | |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4453 * Conversation UI operations |
4359 | 4454 **************************************************************************/ |
4455 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4456 gaim_gtkconv_destroy(GaimConversation *conv) |
4359 | 4457 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4458 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); |
4359 | 4459 |
4460 if (gtkconv->dialogs.fg_color != NULL) | |
4461 gtk_widget_destroy(gtkconv->dialogs.fg_color); | |
4462 | |
4463 if (gtkconv->dialogs.bg_color != NULL) | |
4464 gtk_widget_destroy(gtkconv->dialogs.bg_color); | |
4465 | |
4466 if (gtkconv->dialogs.font != NULL) | |
4467 gtk_widget_destroy(gtkconv->dialogs.font); | |
4468 | |
5959 | 4469 if (gtkconv->dialogs.image != NULL) |
4470 gtk_widget_destroy(gtkconv->dialogs.image); | |
4471 | |
4359 | 4472 if (gtkconv->dialogs.smiley != NULL) |
4473 gtk_widget_destroy(gtkconv->dialogs.smiley); | |
4474 | |
4475 if (gtkconv->dialogs.link != NULL) | |
4476 gtk_widget_destroy(gtkconv->dialogs.link); | |
4477 | |
4478 if (gtkconv->dialogs.log != NULL) | |
4479 gtk_widget_destroy(gtkconv->dialogs.log); | |
4480 | |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4481 gtk_widget_destroy(gtkconv->tab_cont); |
4892 | 4482 g_object_unref(gtkconv->tab_cont); |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4483 |
4359 | 4484 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
4755 | 4485 if (gtkconv->u.im->icon_timer != 0) |
4486 g_source_remove(gtkconv->u.im->icon_timer); | |
4487 | |
4359 | 4488 if (gtkconv->u.im->save_icon != NULL) |
4489 gtk_widget_destroy(gtkconv->u.im->save_icon); | |
4490 | |
4491 if (gtkconv->u.im->anim != NULL) | |
4793 | 4492 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); |
4359 | 4493 |
4494 g_free(gtkconv->u.im); | |
4495 } | |
4496 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
4497 g_free(gtkconv->u.chat); | |
4498 } | |
4499 | |
4633 | 4500 gtk_object_sink(GTK_OBJECT(gtkconv->tooltips)); |
4501 | |
4359 | 4502 g_free(gtkconv); |
4503 } | |
4504 | |
4505 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4506 gaim_gtkconv_write_im(GaimConversation *conv, const char *who, |
6982 | 4507 const char *message, GaimMessageFlags flags, |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4508 time_t mtime) |
4359 | 4509 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4510 GaimGtkConversation *gtkconv; |
4359 | 4511 |
4512 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4513 | |
6621 | 4514 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4515 gaim_prefs_get_bool("/gaim/gtk/conversations/im/raise_on_events")) { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4516 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4517 gaim_conv_window_raise(gaim_conversation_get_window(conv)); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4518 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4519 |
4382
76223649765b
[gaim-migrate @ 4648]
Christian Hammond <chipx86@chipx86.com>
parents:
4378
diff
changeset
|
4520 /* Play a sound, if specified in prefs. */ |
4359 | 4521 if (gtkconv->make_sound) { |
6621 | 4522 if (flags & GAIM_MESSAGE_RECV) { |
4359 | 4523 if (gtkconv->u.im->a_virgin && |
5820 | 4524 gaim_prefs_get_bool("/gaim/gtk/sound/enabled/first_im_recv")) { |
4359 | 4525 |
4561 | 4526 gaim_sound_play_event(GAIM_SOUND_FIRST_RECEIVE); |
4359 | 4527 } |
4528 else | |
4561 | 4529 gaim_sound_play_event(GAIM_SOUND_RECEIVE); |
4359 | 4530 } |
4531 else { | |
4561 | 4532 gaim_sound_play_event(GAIM_SOUND_SEND); |
4359 | 4533 } |
4534 } | |
4535 | |
4536 gtkconv->u.im->a_virgin = FALSE; | |
4537 | |
6982 | 4538 gaim_conversation_write(conv, who, message, flags, mtime); |
4359 | 4539 } |
4540 | |
4541 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4542 gaim_gtkconv_write_chat(GaimConversation *conv, const char *who, |
6621 | 4543 const char *message, GaimMessageFlags flags, time_t mtime) |
4359 | 4544 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4545 GaimGtkConversation *gtkconv; |
4359 | 4546 |
4547 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4548 | |
4382
76223649765b
[gaim-migrate @ 4648]
Christian Hammond <chipx86@chipx86.com>
parents:
4378
diff
changeset
|
4549 /* Play a sound, if specified in prefs. */ |
4359 | 4550 if (gtkconv->make_sound) { |
6621 | 4551 if (!(flags & GAIM_MESSAGE_WHISPER) && (flags & GAIM_MESSAGE_SEND)) |
4561 | 4552 gaim_sound_play_event(GAIM_SOUND_CHAT_YOU_SAY); |
6621 | 4553 else if (flags & GAIM_MESSAGE_RECV) { |
4554 if ((flags & GAIM_MESSAGE_NICK) && | |
6102 | 4555 gaim_prefs_get_bool("/gaim/gtk/sound/enabled/nick_said")) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4556 |
4561 | 4557 gaim_sound_play_event(GAIM_SOUND_CHAT_NICK); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4558 } |
4359 | 4559 else |
4561 | 4560 gaim_sound_play_event(GAIM_SOUND_CHAT_SAY); |
4359 | 4561 } |
4562 } | |
4563 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4564 if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/color_nicks")) |
6621 | 4565 flags |= GAIM_MESSAGE_COLORIZE; |
4359 | 4566 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4567 /* Raise the window, if specified in prefs. */ |
6621 | 4568 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4569 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4570 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4571 gaim_conv_window_raise(gaim_conversation_get_window(conv)); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4572 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4573 |
6982 | 4574 gaim_conversation_write(conv, who, message, flags, mtime); |
4359 | 4575 } |
4576 | |
4577 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4578 gaim_gtkconv_write_conv(GaimConversation *conv, const char *who, |
6982 | 4579 const char *message, GaimMessageFlags flags, |
4359 | 4580 time_t mtime) |
4581 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4582 GaimGtkConversation *gtkconv; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4583 GaimConvWindow *win; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
4584 GaimConnection *gc; |
4359 | 4585 int gtk_font_options = 0; |
6982 | 4586 GSList *images = NULL; |
7440 | 4587 char buf[BUF_LONG]; |
4359 | 4588 char buf2[BUF_LONG]; |
4589 char mdate[64]; | |
4590 char color[10]; | |
4591 char *str; | |
4592 char *with_font_tag; | |
4896 | 4593 char *sml_attrib = NULL; |
6982 | 4594 size_t length = strlen(message) + 1; |
4895 | 4595 |
4359 | 4596 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4597 gc = gaim_conversation_get_gc(conv); | |
4598 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4599 win = gaim_conversation_get_window(conv); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4600 |
6621 | 4601 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
7431 | 4602 ((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT && |
4603 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) || | |
4604 (gaim_conversation_get_type(conv) == GAIM_CONV_IM && | |
4605 (gaim_prefs_get_bool("/gaim/gtk/conversations/im/raise_on_events") || | |
4606 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
|
4607 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4608 gaim_conv_window_show(win); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4609 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4610 |
7078 | 4611 if (flags & GAIM_MESSAGE_IMAGES) |
4612 gaim_gtk_find_images(message, &images); | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4613 |
5133 | 4614 if(time(NULL) > mtime + 20*60) /* show date if older than 20 minutes */ |
4615 strftime(mdate, sizeof(mdate), "%Y-%m-%d %H:%M:%S", localtime(&mtime)); | |
4616 else | |
4617 strftime(mdate, sizeof(mdate), "%H:%M:%S", localtime(&mtime)); | |
4359 | 4618 |
4896 | 4619 if(gc) |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4620 sml_attrib = g_strdup_printf("sml=\"%s\"", gc->prpl->info->name); |
7440 | 4621 |
4359 | 4622 gtk_font_options ^= GTK_IMHTML_NO_COMMENTS; |
4623 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4624 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_colors")) |
4359 | 4625 gtk_font_options ^= GTK_IMHTML_NO_COLOURS; |
4626 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4627 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_fonts")) |
4359 | 4628 gtk_font_options ^= GTK_IMHTML_NO_FONTS; |
4629 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4630 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_font_sizes")) |
4359 | 4631 gtk_font_options ^= GTK_IMHTML_NO_SIZES; |
4632 | |
7956 | 4633 /* this is gonna crash one day, I can feel it. */ |
4634 if (GAIM_PLUGIN_PROTOCOL_INFO(gaim_find_prpl(gaim_account_get_protocol_id(conv->account)))->options & | |
7431 | 4635 OPT_PROTO_USE_POINTSIZE) { |
5367 | 4636 gtk_font_options ^= GTK_IMHTML_USE_POINTSIZE; |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4637 } |
4359 | 4638 |
6621 | 4639 if (flags & GAIM_MESSAGE_SYSTEM) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4640 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) |
5329 | 4641 g_snprintf(buf, BUF_LONG, "(%s) <B>%s</B>", |
7431 | 4642 mdate, message); |
4359 | 4643 else |
4644 g_snprintf(buf, BUF_LONG, "<B>%s</B>", message); | |
7440 | 4645 |
4359 | 4646 g_snprintf(buf2, sizeof(buf2), |
7850 | 4647 "<FONT %s><!--(%s) --><B>%s</B></FONT><BR>", |
4648 sml_attrib, mdate, message); | |
7440 | 4649 |
6982 | 4650 gtk_imhtml_append_text_with_images(GTK_IMHTML(gtkconv->imhtml), buf2, 0, images); |
7440 | 4651 |
7583 | 4652 /* Add the message to a conversations scrollback buffer */ |
4653 conv->history = g_string_append(conv->history, buf); | |
4654 conv->history = g_string_append(conv->history, "<BR>\n"); | |
7440 | 4655 |
7431 | 4656 } else if (flags & GAIM_MESSAGE_NO_LOG) { |
4359 | 4657 g_snprintf(buf, BUF_LONG, |
7850 | 4658 "<B><FONT %s COLOR=\"#777777\">%s</FONT></B><BR>", |
4659 sml_attrib, message); | |
7440 | 4660 |
6982 | 4661 gtk_imhtml_append_text_with_images(GTK_IMHTML(gtkconv->imhtml), buf, 0, images); |
4359 | 4662 } |
4663 else { | |
4895 | 4664 char *new_message = g_memdup(message, length); |
7440 | 4665 |
6621 | 4666 if (flags & GAIM_MESSAGE_WHISPER) { |
4359 | 4667 str = g_malloc(1024); |
7440 | 4668 |
4359 | 4669 /* If we're whispering, it's not an autoresponse. */ |
7564 | 4670 if (gaim_message_meify(new_message, length)) { |
4359 | 4671 g_snprintf(str, 1024, "***%s", who); |
4672 strcpy(color, "#6C2585"); | |
4673 } | |
4674 else { | |
4675 g_snprintf(str, 1024, "*%s*:", who); | |
4676 strcpy(color, "#00FF00"); | |
4677 } | |
7440 | 4678 } |
4359 | 4679 else { |
7564 | 4680 if (gaim_message_meify(new_message, length)) { |
4359 | 4681 str = g_malloc(1024); |
7440 | 4682 |
6621 | 4683 if (flags & GAIM_MESSAGE_AUTO_RESP) |
4359 | 4684 g_snprintf(str, 1024, "%s ***%s", AUTO_RESPONSE, who); |
4685 else | |
4686 g_snprintf(str, 1024, "***%s", who); | |
7440 | 4687 |
6621 | 4688 if (flags & GAIM_MESSAGE_NICK) |
4359 | 4689 strcpy(color, "#AF7F00"); |
4690 else | |
4691 strcpy(color, "#062585"); | |
4692 } | |
4693 else { | |
4694 str = g_malloc(1024); | |
6621 | 4695 if (flags & GAIM_MESSAGE_AUTO_RESP) |
4359 | 4696 g_snprintf(str, 1024, "%s %s", who, AUTO_RESPONSE); |
4697 else | |
4698 g_snprintf(str, 1024, "%s:", who); | |
6621 | 4699 if (flags & GAIM_MESSAGE_NICK) |
4359 | 4700 strcpy(color, "#AF7F00"); |
6621 | 4701 else if (flags & GAIM_MESSAGE_RECV) { |
4702 if (flags & GAIM_MESSAGE_COLORIZE) { | |
4359 | 4703 const char *u; |
4704 int m = 0; | |
7440 | 4705 |
4359 | 4706 for (u = who; *u != '\0'; u++) |
4707 m += *u; | |
7440 | 4708 |
4359 | 4709 m = m % NUM_NICK_COLORS; |
7440 | 4710 |
4359 | 4711 strcpy(color, nick_colors[m]); |
4712 } | |
4713 else | |
7854 | 4714 strcpy(color, RECV_COLOR); |
4359 | 4715 } |
6621 | 4716 else if (flags & GAIM_MESSAGE_SEND) |
7854 | 4717 strcpy(color, SEND_COLOR); |
4359 | 4718 } |
4719 } | |
7440 | 4720 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4721 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) |
4359 | 4722 g_snprintf(buf, BUF_LONG, |
7431 | 4723 "<FONT COLOR=\"%s\" %s>(%s) " |
4724 "<B>%s</B></FONT> ", color, | |
4725 sml_attrib ? sml_attrib : "", mdate, str); | |
4359 | 4726 else |
4727 g_snprintf(buf, BUF_LONG, | |
7431 | 4728 "<FONT COLOR=\"%s\" %s><B>%s</B></FONT> ", color, |
4729 sml_attrib ? sml_attrib : "", str); | |
7440 | 4730 |
4359 | 4731 g_snprintf(buf2, BUF_LONG, |
7431 | 4732 "<FONT COLOR=\"%s\" %s><!--(%s) -->" |
4733 "<B>%s</B></FONT> ", | |
4734 color, sml_attrib ? sml_attrib : "", mdate, str); | |
7440 | 4735 |
4359 | 4736 g_free(str); |
4737 | |
6982 | 4738 gtk_imhtml_append_text_with_images(GTK_IMHTML(gtkconv->imhtml), buf2, 0, images); |
4359 | 4739 |
4895 | 4740 if(gc){ |
4896 | 4741 char *pre = g_strdup_printf("<font %s>", sml_attrib ? sml_attrib : ""); |
4895 | 4742 char *post = "</font>"; |
4743 int pre_len = strlen(pre); | |
4744 int post_len = strlen(post); | |
7440 | 4745 |
4895 | 4746 with_font_tag = g_malloc(length + pre_len + post_len + 1); |
7440 | 4747 |
4895 | 4748 strcpy(with_font_tag, pre); |
4749 memcpy(with_font_tag + pre_len, new_message, length); | |
4750 strcpy(with_font_tag + pre_len + length, post); | |
7440 | 4751 |
4895 | 4752 length += pre_len + post_len; |
4753 g_free(pre); | |
4754 } | |
4608 | 4755 else |
4895 | 4756 with_font_tag = g_memdup(new_message, length); |
7440 | 4757 |
7589 | 4758 gtk_imhtml_append_text_with_images(GTK_IMHTML(gtkconv->imhtml), |
7431 | 4759 with_font_tag, gtk_font_options, images); |
7440 | 4760 |
6982 | 4761 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", 0); |
7440 | 4762 |
7431 | 4763 /*conv->history = g_string_append(conv->history, t1); |
4764 conv->history = g_string_append(conv->history, t2); | |
4765 conv->history = g_string_append(conv->history, "\n"); | |
7440 | 4766 |
7431 | 4767 g_free(t1); |
4768 g_free(t2); */ | |
7440 | 4769 |
4770 g_free(with_font_tag); | |
7447 | 4771 g_free(new_message); |
7440 | 4772 } |
4773 | |
6062 | 4774 |
5012 | 4775 if(sml_attrib) |
4776 g_free(sml_attrib); | |
6982 | 4777 |
4778 if (images) { | |
7078 | 4779 GSList *tmp; |
4780 | |
4781 for (tmp = images; tmp; tmp = tmp->next) { | |
4782 GdkPixbuf *pixbuf = tmp->data; | |
4783 if(pixbuf) | |
4784 g_object_unref(pixbuf); | |
6982 | 4785 } |
7078 | 4786 |
6982 | 4787 g_slist_free(images); |
4788 } | |
4359 | 4789 } |
4790 | |
4791 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4792 gaim_gtkconv_chat_add_user(GaimConversation *conv, const char *user) |
4359 | 4793 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4794 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4795 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4796 GaimGtkChatPane *gtkchat; |
4359 | 4797 char tmp[BUF_LONG]; |
4798 int num_users; | |
4799 int pos; | |
4800 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4801 chat = GAIM_CONV_CHAT(conv); |
4359 | 4802 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4803 gtkchat = gtkconv->u.chat; | |
4804 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4805 num_users = g_list_length(gaim_conv_chat_get_users(chat)); |
4359 | 4806 |
4807 g_snprintf(tmp, sizeof(tmp), | |
4808 ngettext("%d person in room", "%d people in room", | |
4809 num_users), | |
4810 num_users); | |
4811 | |
4812 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); | |
4813 | |
4814 if (gtkconv->make_sound) | |
4561 | 4815 gaim_sound_play_event(GAIM_SOUND_CHAT_JOIN); |
4359 | 4816 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4817 pos = g_list_index(gaim_conv_chat_get_users(chat), user); |
4359 | 4818 |
4819 add_chat_buddy_common(conv, user, pos); | |
4820 } | |
4821 | |
4822 static void | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4823 gaim_gtkconv_chat_add_users(GaimConversation *conv, GList *users) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4824 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4825 GaimConvChat *chat; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4826 GaimGtkConversation *gtkconv; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4827 GaimGtkChatPane *gtkchat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4828 GList *l; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4829 char tmp[BUF_LONG]; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4830 int num_users; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4831 int pos; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4832 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4833 chat = GAIM_CONV_CHAT(conv); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4834 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4835 gtkchat = gtkconv->u.chat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4836 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4837 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
|
4838 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4839 g_snprintf(tmp, sizeof(tmp), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4840 ngettext("%d person in room", "%d people in room", |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4841 num_users), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4842 num_users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4843 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4844 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4845 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4846 for (l = users; l != NULL; l = l->next) { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4847 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
|
4848 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4849 add_chat_buddy_common(conv, (char *)l->data, pos); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4850 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4851 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4852 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4853 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4854 gaim_gtkconv_chat_rename_user(GaimConversation *conv, const char *old_name, |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4855 const char *new_name) |
4359 | 4856 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4857 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4858 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4859 GaimGtkChatPane *gtkchat; |
4359 | 4860 GtkTreeIter iter; |
4861 GtkTreeModel *model; | |
4862 GList *names; | |
4863 int pos; | |
4864 int f = 1; | |
4865 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4866 chat = GAIM_CONV_CHAT(conv); |
4359 | 4867 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4868 gtkchat = gtkconv->u.chat; | |
4869 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4870 for (names = gaim_conv_chat_get_users(chat); |
4359 | 4871 names != NULL; |
4872 names = names->next) { | |
4873 | |
4874 char *u = (char *)names->data; | |
4875 | |
4793 | 4876 if (!gaim_utf8_strcasecmp(u, old_name)) { |
4359 | 4877 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
4878 | |
4879 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
4880 break; | |
4881 | |
4882 while (f != 0) { | |
4883 char *val; | |
4884 | |
4885 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &val, -1); | |
4886 | |
4793 | 4887 if (!gaim_utf8_strcasecmp(old_name, val)) { |
4359 | 4888 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
4640 | 4889 break; |
4890 } | |
4359 | 4891 |
4892 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
4893 | |
4894 g_free(val); | |
4895 } | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
4896 |
4359 | 4897 break; |
4898 } | |
4899 } | |
4900 | |
4901 if (!names) | |
4902 return; | |
4903 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4904 pos = g_list_index(gaim_conv_chat_get_users(chat), new_name); |
4359 | 4905 |
4906 add_chat_buddy_common(conv, new_name, pos); | |
4907 } | |
4908 | |
4909 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4910 gaim_gtkconv_chat_remove_user(GaimConversation *conv, const char *user) |
4359 | 4911 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4912 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4913 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4914 GaimGtkChatPane *gtkchat; |
4359 | 4915 GtkTreeIter iter; |
4916 GtkTreeModel *model; | |
4917 GList *names; | |
4918 char tmp[BUF_LONG]; | |
4919 int num_users; | |
4920 int f = 1; | |
4921 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4922 chat = GAIM_CONV_CHAT(conv); |
4359 | 4923 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4924 gtkchat = gtkconv->u.chat; | |
4925 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4926 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
|
4927 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4928 for (names = gaim_conv_chat_get_users(chat); |
4359 | 4929 names != NULL; |
4930 names = names->next) { | |
4931 | |
4932 char *u = (char *)names->data; | |
4933 | |
4793 | 4934 if (!gaim_utf8_strcasecmp(u, user)) { |
4359 | 4935 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
4936 | |
4937 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
4938 break; | |
4939 | |
4940 while (f != 0) { | |
4941 char *val; | |
4942 | |
4943 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &val, -1); | |
4944 | |
4793 | 4945 if (!gaim_utf8_strcasecmp(user, val)) |
4359 | 4946 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
4947 | |
4948 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
4949 | |
4950 g_free(val); | |
4951 } | |
4952 | |
4953 break; | |
4954 } | |
4955 } | |
4956 | |
4957 if (names == NULL) | |
4958 return; | |
4959 | |
4960 g_snprintf(tmp, sizeof(tmp), | |
4961 ngettext("%d person in room", "%d people in room", | |
4962 num_users), num_users); | |
4963 | |
4964 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); | |
4965 | |
4966 if (gtkconv->make_sound) | |
4561 | 4967 gaim_sound_play_event(GAIM_SOUND_CHAT_LEAVE); |
4359 | 4968 } |
4969 | |
4970 static void | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4971 gaim_gtkconv_chat_remove_users(GaimConversation *conv, GList *users) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4972 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4973 GaimConvChat *chat; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4974 GaimGtkConversation *gtkconv; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4975 GaimGtkChatPane *gtkchat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4976 GtkTreeIter iter; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4977 GtkTreeModel *model; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4978 GList *names = NULL; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4979 GList *l; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4980 char tmp[BUF_LONG]; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4981 int num_users; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4982 int f = 1; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4983 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4984 chat = GAIM_CONV_CHAT(conv); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4985 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4986 gtkchat = gtkconv->u.chat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4987 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4988 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
|
4989 g_list_length(users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4990 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4991 for (l = users; l != NULL; l = l->next) { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4992 for (names = gaim_conv_chat_get_users(chat); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4993 names != NULL; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4994 names = names->next) { |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4995 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4996 char *u = (char *)names->data; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4997 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4998 if (!gaim_utf8_strcasecmp(u, (char *)l->data)) { |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
4999 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5000 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5001 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5002 &iter)) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5003 break; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5004 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5005 while (f != 0) { |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5006 char *val; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5007 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5008 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5009 1, &val, -1); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5010 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5011 if (!gaim_utf8_strcasecmp((char *)l->data, val)) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5012 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5013 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5014 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5015 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5016 g_free(val); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5017 } |
7431 | 5018 |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5019 break; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5020 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5021 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5022 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5023 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5024 if (names == NULL) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5025 return; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5026 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5027 g_snprintf(tmp, sizeof(tmp), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5028 ngettext("%d person in room", "%d people in room", |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5029 num_users), num_users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5030 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5031 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5032 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5033 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5034 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5035 gaim_gtkconv_set_title(GaimConversation *conv, const char *title) |
4359 | 5036 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5037 GaimGtkConversation *gtkconv; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5038 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5039 GaimGtkWindow *gtkwin; |
4681 | 5040 |
5041 win = gaim_conversation_get_window(conv); | |
5042 gtkwin = GAIM_GTK_WINDOW(win); | |
4359 | 5043 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5044 | |
5045 gtk_label_set_text(GTK_LABEL(gtkconv->tab_label), title); | |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
5046 gtk_label_set_text(GTK_LABEL(gtkconv->menu_label), title); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5047 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5048 if(conv == gaim_conv_window_get_active_conversation(win)) |
4681 | 5049 gtk_window_set_title(GTK_WINDOW(gtkwin->window), title); |
4359 | 5050 } |
5051 | |
5052 static void | |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5053 update_tab_icon(GaimConversation *conv) |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5054 { |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5055 GaimGtkConversation *gtkconv; |
7146 | 5056 GaimConvWindow *win = gaim_conversation_get_window(conv); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5057 GaimAccount *account; |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5058 const char *name; |
7008 | 5059 GdkPixbuf *status = NULL; |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5060 |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5061 gtkconv = GAIM_GTK_CONVERSATION(conv); |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5062 name = gaim_conversation_get_name(conv); |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5063 account = gaim_conversation_get_account(conv); |
6440 | 5064 |
7143 | 5065 status = get_tab_icon(conv); |
7008 | 5066 |
5067 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->icon), status); | |
5068 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->menu_icon), status); | |
5069 | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5070 if (gaim_conv_window_get_active_conversation(win) == conv && gtkconv->u.im->anim == NULL) |
7146 | 5071 gtk_window_set_icon(GTK_WINDOW(GAIM_GTK_WINDOW(win)->window), status); |
5072 | |
7008 | 5073 if(status) |
5074 g_object_unref(status); | |
7146 | 5075 |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5076 } |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5077 |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5078 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5079 gaim_gtkconv_updated(GaimConversation *conv, GaimConvUpdateType type) |
4359 | 5080 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5081 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5082 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5083 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5084 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5085 GaimConvChat *chat; |
4359 | 5086 |
5087 win = gaim_conversation_get_window(conv); | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5088 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 5089 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5090 | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5091 if (type == GAIM_CONV_UPDATE_ACCOUNT) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5092 { |
4359 | 5093 gaim_conversation_autoset_title(conv); |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5094 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5095 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5096 gaim_gtkconv_update_buddy_icon(conv); |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5097 |
4359 | 5098 gaim_gtkconv_update_buttons_by_protocol(conv); |
5099 | |
4685 | 5100 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); |
4359 | 5101 |
5102 smiley_themeize(gtkconv->imhtml); | |
6394 | 5103 |
6395 | 5104 update_tab_icon(conv); |
4359 | 5105 } |
5106 else if (type == GAIM_CONV_UPDATE_TYPING || | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5107 type == GAIM_CONV_UPDATE_UNSEEN) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5108 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5109 const char *title; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5110 GaimConvIm *im = NULL; |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5111 char color[8]; |
4736 | 5112 |
4359 | 5113 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5114 im = GAIM_CONV_IM(conv); |
4359 | 5115 |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5116 title = gaim_conversation_get_title(conv); |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5117 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5118 *color = '\0'; |
4359 | 5119 |
5120 if (!GTK_WIDGET_REALIZED(gtkconv->tab_label)) | |
5121 gtk_widget_realize(gtkconv->tab_label); | |
5122 | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5123 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
|
5124 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5125 strcpy(color, "#47A046"); |
4359 | 5126 } |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5127 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
|
5128 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5129 strcpy(color, "#D1940C"); |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5130 } |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5131 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_NICK) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5132 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5133 strcpy(color, "#314E6C"); |
4359 | 5134 } |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5135 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_EVENT) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5136 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5137 strcpy(color, "#868272"); |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5138 } |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5139 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_TEXT) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5140 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5141 strcpy(color, "#DF421E"); |
4359 | 5142 } |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5143 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5144 if (*color != '\0') |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5145 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5146 char *label; |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5147 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5148 label = g_strdup_printf("<span color=\"%s\">%s</span>", |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5149 color, title); |
7995
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
5150 gtk_label_set_markup(GTK_LABEL(gtkconv->tab_label), label); |
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
5151 g_free(label); |
4359 | 5152 } |
7995
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
5153 else |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5154 gtk_label_set_text(GTK_LABEL(gtkconv->tab_label), title); |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5155 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5156 if (conv == gaim_conv_window_get_active_conversation(win)) |
4736 | 5157 update_typing_icon(conv); |
4359 | 5158 } |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5159 else if (type == GAIM_CONV_UPDATE_TOPIC) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5160 { |
7154 | 5161 const char *topic; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5162 chat = GAIM_CONV_CHAT(conv); |
4359 | 5163 gtkchat = gtkconv->u.chat; |
5164 | |
7154 | 5165 topic = gaim_conv_chat_get_topic(chat); |
5166 | |
5167 gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text),topic); | |
5168 gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->topic_text, | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5169 topic, NULL); |
4359 | 5170 } |
5171 else if (type == GAIM_CONV_ACCOUNT_ONLINE || | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5172 type == GAIM_CONV_ACCOUNT_OFFLINE) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5173 { |
7929 | 5174 gray_stuff_out(gaim_conv_window_get_active_conversation(win)); |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
5175 generate_send_as_items(win, NULL); |
6440 | 5176 if (gaim_prefs_get_bool("/gaim/gtk/conversations/icons_on_tabs")) |
5177 update_tab_icon(conv); | |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5178 } |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5179 else if (type == GAIM_CONV_UPDATE_AWAY) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5180 { |
6440 | 5181 if (gaim_prefs_get_bool("/gaim/gtk/conversations/icons_on_tabs")) |
5182 update_tab_icon(conv); | |
4359 | 5183 } |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5184 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
|
5185 { |
7929 | 5186 gray_stuff_out(conv); |
4397
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
5187 } |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5188 else if (type == GAIM_CONV_UPDATE_ICON) |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5189 { |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5190 gaim_gtkconv_update_buddy_icon(conv); |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5191 } |
4359 | 5192 } |
5193 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5194 static GaimConversationUiOps conversation_ui_ops = |
4359 | 5195 { |
5196 gaim_gtkconv_destroy, /* destroy_conversation */ | |
5197 gaim_gtkconv_write_chat, /* write_chat */ | |
5198 gaim_gtkconv_write_im, /* write_im */ | |
5199 gaim_gtkconv_write_conv, /* write_conv */ | |
5200 gaim_gtkconv_chat_add_user, /* chat_add_user */ | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5201 gaim_gtkconv_chat_add_users, /* chat_add_users */ |
4359 | 5202 gaim_gtkconv_chat_rename_user, /* chat_rename_user */ |
5203 gaim_gtkconv_chat_remove_user, /* chat_remove_user */ | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5204 gaim_gtkconv_chat_remove_users, /* chat_remove_users */ |
4359 | 5205 gaim_gtkconv_set_title, /* set_title */ |
5206 NULL, /* update_progress */ | |
5207 gaim_gtkconv_updated /* updated */ | |
5208 }; | |
5209 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5210 GaimConversationUiOps * |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
5211 gaim_gtk_conversations_get_conv_ui_ops(void) |
4359 | 5212 { |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
5213 return &conversation_ui_ops; |
4359 | 5214 } |
5215 | |
5216 /************************************************************************** | |
5217 * Public conversation utility functions | |
5218 **************************************************************************/ | |
5219 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5220 remove_icon(GaimGtkConversation *gtkconv) |
4359 | 5221 { |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5222 g_return_if_fail(gtkconv != NULL); |
4359 | 5223 |
5224 if (gtkconv->u.im->icon != NULL) | |
5225 gtk_container_remove(GTK_CONTAINER(gtkconv->bbox), | |
5226 gtkconv->u.im->icon->parent->parent); | |
5227 | |
5228 if (gtkconv->u.im->anim != NULL) | |
4793 | 5229 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); |
4359 | 5230 |
5231 if (gtkconv->u.im->icon_timer != 0) | |
5232 g_source_remove(gtkconv->u.im->icon_timer); | |
5233 | |
5234 if (gtkconv->u.im->iter != NULL) | |
5235 g_object_unref(G_OBJECT(gtkconv->u.im->iter)); | |
5236 | |
5237 gtkconv->u.im->icon_timer = 0; | |
5238 gtkconv->u.im->icon = NULL; | |
5239 gtkconv->u.im->anim = NULL; | |
5240 gtkconv->u.im->iter = NULL; | |
5241 } | |
5242 | |
5243 static gboolean | |
5244 redraw_icon(gpointer data) | |
5245 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5246 GaimConversation *conv = (GaimConversation *)data; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5247 GaimGtkConversation *gtkconv; |
4359 | 5248 |
5249 GdkPixbuf *buf; | |
5250 GdkPixbuf *scale; | |
5251 GdkPixmap *pm; | |
5252 GdkBitmap *bm; | |
5253 gint delay; | |
5254 | |
5255 if (!g_list_find(gaim_get_ims(), conv)) { | |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5256 gaim_debug(GAIM_DEBUG_WARNING, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5257 "Conversation not found in redraw_icon. I think this " |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5258 "is a bug.\n"); |
4359 | 5259 return FALSE; |
5260 } | |
5261 | |
5262 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5263 | |
5264 gdk_pixbuf_animation_iter_advance(gtkconv->u.im->iter, NULL); | |
5265 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); | |
5266 | |
5267 scale = gdk_pixbuf_scale_simple(buf, | |
5268 MAX(gdk_pixbuf_get_width(buf) * SCALE(gtkconv->u.im->anim) / | |
5269 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), | |
5270 MAX(gdk_pixbuf_get_height(buf) * SCALE(gtkconv->u.im->anim) / | |
5271 gdk_pixbuf_animation_get_height(gtkconv->u.im->anim), 1), | |
5272 GDK_INTERP_NEAREST); | |
5273 | |
5274 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); | |
4793 | 5275 g_object_unref(G_OBJECT(scale)); |
4635 | 5276 gtk_image_set_from_pixmap(GTK_IMAGE(gtkconv->u.im->icon), pm, bm); |
4793 | 5277 g_object_unref(G_OBJECT(pm)); |
4359 | 5278 gtk_widget_queue_draw(gtkconv->u.im->icon); |
5279 | |
5280 if (bm) | |
4793 | 5281 g_object_unref(G_OBJECT(bm)); |
4359 | 5282 |
5283 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter) / 10; | |
5284 | |
5285 gtkconv->u.im->icon_timer = g_timeout_add(delay * 10, redraw_icon, conv); | |
5286 | |
5287 return FALSE; | |
5288 } | |
5289 | |
5290 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5291 start_anim(GtkObject *obj, GaimConversation *conv) |
4359 | 5292 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5293 GaimGtkConversation *gtkconv; |
4359 | 5294 int delay; |
5295 | |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5296 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
4359 | 5297 return; |
5298 | |
5299 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5300 | |
6016 | 5301 if (gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim)) |
5302 return; | |
5303 | |
4359 | 5304 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter) / 10; |
5305 | |
5306 if (gtkconv->u.im->anim) | |
5307 gtkconv->u.im->icon_timer = g_timeout_add(delay * 10, redraw_icon, | |
5308 conv); | |
5309 } | |
5310 | |
5311 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5312 stop_anim(GtkObject *obj, GaimConversation *conv) |
4359 | 5313 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5314 GaimGtkConversation *gtkconv; |
4359 | 5315 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5316 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
4359 | 5317 return; |
5318 | |
5319 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5320 | |
5321 if (gtkconv->u.im->icon_timer != 0) | |
5322 g_source_remove(gtkconv->u.im->icon_timer); | |
5323 | |
5324 gtkconv->u.im->icon_timer = 0; | |
5325 } | |
5326 | |
7300
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5327 static void |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5328 toggle_icon_animate_cb(GtkWidget *w, GaimConversation *conv) |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5329 { |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5330 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
|
5331 start_anim(NULL, conv); |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5332 else |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5333 stop_anim(NULL, conv); |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5334 } |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5335 |
4359 | 5336 static gboolean |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5337 icon_menu(GtkObject *obj, GdkEventButton *e, GaimConversation *conv) |
4359 | 5338 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5339 GaimGtkConversation *gtkconv; |
4359 | 5340 static GtkWidget *menu = NULL; |
5341 GtkWidget *button; | |
5342 | |
5343 if (e->button != 3 || e->type != GDK_BUTTON_PRESS) | |
5344 return FALSE; | |
5345 | |
5346 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5347 | |
5348 /* | |
5349 * If a menu already exists, destroy it before creating a new one, | |
5350 * thus freeing-up the memory it occupied. | |
5351 */ | |
5352 if (menu != NULL) | |
5353 gtk_widget_destroy(menu); | |
5354 | |
5355 menu = gtk_menu_new(); | |
5356 | |
7300
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5357 if (gtkconv->u.im->anim && |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5358 !(gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim))) |
4359 | 5359 { |
7300
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5360 gaim_new_check_item(menu, _("Animate"), |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5361 G_CALLBACK(toggle_icon_animate_cb), conv, |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5362 gtkconv->u.im->icon_timer); |
4359 | 5363 } |
5364 | |
5365 button = gtk_menu_item_new_with_label(_("Hide Icon")); | |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
5366 g_signal_connect_swapped(G_OBJECT(button), "activate", |
4515
9b9737a00a96
[gaim-migrate @ 4793]
Christian Hammond <chipx86@chipx86.com>
parents:
4513
diff
changeset
|
5367 G_CALLBACK(remove_icon), gtkconv); |
4359 | 5368 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); |
5369 gtk_widget_show(button); | |
5370 | |
7300
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5371 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
|
5372 G_CALLBACK(gaim_gtk_save_icon_dialog), conv, |
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
5373 0, 0, NULL); |
4359 | 5374 |
5375 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, e->button, e->time); | |
5376 | |
5377 return TRUE; | |
5378 } | |
5379 | |
5380 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5381 gaim_gtkconv_update_buddy_icon(GaimConversation *conv) |
4359 | 5382 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5383 GaimGtkConversation *gtkconv; |
7143 | 5384 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); |
4359 | 5385 |
5386 char filename[256]; | |
5387 FILE *file; | |
5388 GError *err = NULL; | |
5462
8355eeeb52a3
[gaim-migrate @ 5853]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
5389 gboolean animate = TRUE; |
4359 | 5390 |
6695 | 5391 GaimBuddy *buddy; |
4757 | 5392 |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5393 const void *data; |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5394 size_t len; |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5395 int delay; |
4359 | 5396 |
5397 GdkPixbuf *buf; | |
5398 | |
5399 GtkWidget *event; | |
5400 GtkWidget *frame; | |
5401 GdkPixbuf *scale; | |
5402 GdkPixmap *pm; | |
5403 GdkBitmap *bm; | |
5404 int sf = 0; | |
5405 | |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5406 g_return_if_fail(conv != NULL); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5407 g_return_if_fail(GAIM_IS_GTK_CONVERSATION(conv)); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5408 g_return_if_fail(gaim_conversation_get_type(conv) == GAIM_CONV_IM); |
4359 | 5409 |
5410 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5411 | |
5462
8355eeeb52a3
[gaim-migrate @ 5853]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
5412 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
|
5413 animate = FALSE; |
8355eeeb52a3
[gaim-migrate @ 5853]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
5414 |
4359 | 5415 remove_icon(gtkconv); |
5416 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5417 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/im/show_buddy_icons")) |
4359 | 5418 return; |
5419 | |
5420 if (gaim_conversation_get_gc(conv) == NULL) | |
5421 return; | |
5422 | |
4793 | 5423 if(gtkconv->u.im->anim) |
5424 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); | |
5425 | |
4757 | 5426 if((buddy = gaim_find_buddy(gaim_conversation_get_account(conv), |
5427 gaim_conversation_get_name(conv))) != NULL) { | |
7125 | 5428 const char *file; |
7693 | 5429 if((file = gaim_blist_node_get_string((GaimBlistNode*)buddy, "buddy_icon"))) |
4757 | 5430 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
|
5431 } |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5432 else |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5433 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5434 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
|
5435 |
6877
1b5b0cea6915
[gaim-migrate @ 7423]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
5436 if (icon == NULL) |
1b5b0cea6915
[gaim-migrate @ 7423]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
5437 return; |
1b5b0cea6915
[gaim-migrate @ 7423]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
5438 |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5439 data = gaim_buddy_icon_get_data(icon, &len); |
4757 | 5440 |
5441 /* this is such an evil hack, i don't know why i'm even considering it. | |
5442 * we'll do it differently when gdk-pixbuf-loader isn't leaky anymore. */ | |
5443 g_snprintf(filename, sizeof(filename), | |
5444 "%s" G_DIR_SEPARATOR_S "gaimicon-%s.%d", | |
5445 g_get_tmp_dir(), gaim_conversation_get_name(conv), getpid()); | |
5446 | |
5447 if (!(file = fopen(filename, "wb"))) | |
5448 return; | |
5449 | |
5450 fwrite(data, 1, len, file); | |
5451 fclose(file); | |
5452 | |
5453 gtkconv->u.im->anim = gdk_pixbuf_animation_new_from_file(filename, &err); | |
5454 /* make sure we remove the file as soon as possible */ | |
5455 unlink(filename); | |
5456 } | |
4359 | 5457 |
5458 if (err) { | |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5459 gaim_debug(GAIM_DEBUG_ERROR, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5460 "Buddy icon error: %s\n", err->message); |
4359 | 5461 g_error_free(err); |
5462 } | |
5463 | |
5464 | |
5465 if (!gtkconv->u.im->anim) | |
5466 return; | |
5467 | |
4793 | 5468 if(gtkconv->u.im->iter) |
5469 g_object_unref(G_OBJECT(gtkconv->u.im->iter)); | |
5470 | |
4359 | 5471 if (gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim)) { |
5472 gtkconv->u.im->iter = NULL; | |
5473 delay = 0; | |
5474 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); | |
5475 } else { | |
5476 gtkconv->u.im->iter = | |
5477 gdk_pixbuf_animation_get_iter(gtkconv->u.im->anim, NULL); | |
5478 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); | |
5479 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter); | |
5480 delay = delay / 10; | |
5481 } | |
5482 | |
5483 sf = SCALE(gtkconv->u.im->anim); | |
5484 scale = gdk_pixbuf_scale_simple(buf, | |
5485 MAX(gdk_pixbuf_get_width(buf) * sf / | |
5486 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), | |
5487 MAX(gdk_pixbuf_get_height(buf) * sf / | |
5488 gdk_pixbuf_animation_get_height(gtkconv->u.im->anim), 1), | |
5489 GDK_INTERP_NEAREST); | |
5490 | |
5491 if (delay) | |
5492 gtkconv->u.im->icon_timer = g_timeout_add(delay * 10, redraw_icon, | |
5493 conv); | |
5494 | |
5495 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); | |
4793 | 5496 g_object_unref(G_OBJECT(scale)); |
4359 | 5497 |
5498 frame = gtk_frame_new(NULL); | |
5499 gtk_frame_set_shadow_type(GTK_FRAME(frame), | |
5500 (bm ? GTK_SHADOW_NONE : GTK_SHADOW_IN)); | |
5501 gtk_box_pack_start(GTK_BOX(gtkconv->bbox), frame, FALSE, FALSE, 5); | |
5502 gtk_box_reorder_child(GTK_BOX(gtkconv->bbox), frame, 0); | |
5503 gtk_widget_show(frame); | |
5504 | |
5505 event = gtk_event_box_new(); | |
5506 gtk_container_add(GTK_CONTAINER(frame), event); | |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
5507 g_signal_connect(G_OBJECT(event), "button-press-event", |
4359 | 5508 G_CALLBACK(icon_menu), conv); |
5509 gtk_widget_show(event); | |
5510 | |
4635 | 5511 gtkconv->u.im->icon = gtk_image_new_from_pixmap(pm, bm); |
4359 | 5512 gtk_widget_set_size_request(gtkconv->u.im->icon, sf, sf); |
5513 gtk_container_add(GTK_CONTAINER(event), gtkconv->u.im->icon); | |
5514 gtk_widget_show(gtkconv->u.im->icon); | |
5515 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5516 if (!animate || |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5517 !gaim_prefs_get_bool("/gaim/gtk/conversations/im/animate_buddy_icons")) { |
4359 | 5518 stop_anim(NULL, conv); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5519 } |
4359 | 5520 |
4793 | 5521 g_object_unref(G_OBJECT(pm)); |
4359 | 5522 |
5523 if (bm) | |
4793 | 5524 g_object_unref(G_OBJECT(bm)); |
7143 | 5525 |
5526 /* The buddy icon code needs badly to be fixed. */ | |
5527 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); | |
5528 gtk_window_set_icon(GTK_WINDOW(gtkwin->window), buf); | |
4359 | 5529 } |
5530 | |
5531 void | |
5532 gaim_gtkconv_update_font_buttons(void) | |
5533 { | |
5534 GList *l; | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5535 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5536 GaimGtkConversation *gtkconv; |
4359 | 5537 |
5538 for (l = gaim_get_ims(); l != NULL; l = l->next) { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5539 conv = (GaimConversation *)l->data; |
4359 | 5540 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5541 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
4359 | 5542 continue; |
5543 | |
5544 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5545 | |
5546 if (gtkconv->toolbar.bold != NULL) | |
5547 gtk_widget_set_sensitive(gtkconv->toolbar.bold, | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5548 !gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold")); |
4359 | 5549 |
5550 if (gtkconv->toolbar.italic != NULL) | |
5551 gtk_widget_set_sensitive(gtkconv->toolbar.italic, | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5552 !gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic")); |
4359 | 5553 |
5554 if (gtkconv->toolbar.underline != NULL) | |
5555 gtk_widget_set_sensitive(gtkconv->toolbar.underline, | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5556 !gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline")); |
4359 | 5557 } |
5558 } | |
5559 | |
5560 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5561 gaim_gtkconv_update_font_colors(GaimConversation *conv) |
4421 | 5562 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5563 GaimGtkConversation *gtkconv; |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
5564 |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5565 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5566 return; |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
5567 |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5568 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5569 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5570 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5571 >kconv->fg_color); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5572 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5573 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5574 >kconv->bg_color); |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5575 } |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5576 |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5577 void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5578 gaim_gtkconv_update_font_face(GaimConversation *conv) |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5579 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5580 GaimGtkConversation *gtkconv; |
6141 | 5581 |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5582 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5583 return; |
6141 | 5584 |
4438
2054d8429925
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
5585 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
5586 |
6141 | 5587 strncpy(gtkconv->fontface, |
5588 gaim_prefs_get_string("/gaim/gtk/conversations/font_face"), | |
5589 sizeof(gtkconv->fontface)); | |
4421 | 5590 } |
5591 | |
5592 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5593 gaim_gtkconv_update_buttons_by_protocol(GaimConversation *conv) |
4359 | 5594 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5595 GaimConvWindow *win; |
4359 | 5596 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5597 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
4359 | 5598 return; |
5599 | |
7887 | 5600 win = gaim_conversation_get_window(conv); |
5601 | |
5602 if (win != NULL && gaim_conv_window_get_active_conversation(win) == conv) | |
5603 gray_stuff_out(conv); | |
4359 | 5604 } |
5605 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5606 GaimConvWindow * |
4359 | 5607 gaim_gtkwin_get_at_xy(int x, int y) |
5608 { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5609 GaimConvWindow *win = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5610 GaimGtkWindow *gtkwin; |
4359 | 5611 GdkWindow *gdkwin; |
5612 GList *l; | |
5613 | |
5614 gdkwin = gdk_window_at_pointer(&x, &y); | |
5615 | |
5616 if (gdkwin) | |
5617 gdkwin = gdk_window_get_toplevel(gdkwin); | |
5618 | |
5619 for (l = gaim_get_windows(); l != NULL; l = l->next) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5620 win = (GaimConvWindow *)l->data; |
4359 | 5621 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5622 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5623 continue; |
5624 | |
5625 gtkwin = GAIM_GTK_WINDOW(win); | |
5626 | |
5627 if (gdkwin == gtkwin->window->window) | |
5628 return win; | |
5629 } | |
5630 | |
5631 return NULL; | |
5632 } | |
5633 | |
5634 int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5635 gaim_gtkconv_get_tab_at_xy(GaimConvWindow *win, int x, int y) |
4359 | 5636 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5637 GaimGtkWindow *gtkwin; |
4359 | 5638 GList *l; |
5639 gint nb_x, nb_y, x_rel, y_rel; | |
5640 GtkNotebook *notebook; | |
5641 GtkWidget *tab; | |
5642 gint i, page_num = 0; | |
5643 gboolean first_visible = TRUE; | |
5644 | |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5645 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5646 return -1; |
5647 | |
5648 gtkwin = GAIM_GTK_WINDOW(win); | |
5649 notebook = GTK_NOTEBOOK(gtkwin->notebook); | |
5650 | |
5651 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
5652 x_rel = x - nb_x; | |
5653 y_rel = y - nb_y; | |
5654 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5655 for (l = gaim_conv_window_get_conversations(win), i = 0; |
4359 | 5656 l != NULL; |
5657 l = l->next, i++) { | |
5658 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5659 GaimConversation *conv = l->data; |
4359 | 5660 tab = GAIM_GTK_CONVERSATION(conv)->tab_label; |
5661 | |
5662 if (!GTK_WIDGET_MAPPED(tab)) | |
5663 continue; | |
5664 | |
5665 if (first_visible) { | |
5666 first_visible = FALSE; | |
5667 | |
5668 if (x_rel < tab->allocation.x) x_rel = tab->allocation.x; | |
5669 if (y_rel < tab->allocation.y) y_rel = tab->allocation.y; | |
5670 } | |
5671 | |
5672 if (gtk_notebook_get_tab_pos(notebook) == GTK_POS_TOP || | |
5673 gtk_notebook_get_tab_pos(notebook) == GTK_POS_BOTTOM) { | |
5674 | |
5675 if (tab->allocation.x <= x_rel) { | |
5676 if (tab->allocation.x + tab->allocation.width <= x_rel) | |
5677 page_num = i + 1; | |
5678 else | |
5679 page_num = i; | |
5680 } | |
5681 else | |
5682 break; | |
5683 } | |
5684 else { | |
5685 if (tab->allocation.y <= y_rel) { | |
5686 if (tab->allocation.y + tab->allocation.height <= y_rel) | |
5687 page_num = i + 1; | |
5688 else | |
5689 page_num = i; | |
5690 } | |
5691 else | |
5692 break; | |
5693 } | |
5694 } | |
5695 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5696 if (i == gaim_conv_window_get_conversation_count(win) + 1) |
4359 | 5697 return -1; |
5698 | |
5699 return page_num; | |
5700 } | |
5701 | |
5702 int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5703 gaim_gtkconv_get_dest_tab_at_xy(GaimConvWindow *win, int x, int y) |
4359 | 5704 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5705 GaimGtkWindow *gtkwin; |
4359 | 5706 GList *l; |
5707 gint nb_x, nb_y, x_rel, y_rel; | |
5708 GtkNotebook *notebook; | |
5709 GtkWidget *tab; | |
5710 gint i, page_num = 0; | |
5711 | |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5712 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5713 return -1; |
5714 | |
5715 gtkwin = GAIM_GTK_WINDOW(win); | |
5716 notebook = GTK_NOTEBOOK(gtkwin->notebook); | |
5717 | |
5718 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
5719 x_rel = x - nb_x; | |
5720 y_rel = y - nb_y; | |
5721 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5722 for (l = gaim_conv_window_get_conversations(win), i = 0; |
4359 | 5723 l != NULL; |
5724 l = l->next, i++) { | |
5725 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5726 GaimConversation *conv = l->data; |
4359 | 5727 tab = GAIM_GTK_CONVERSATION(conv)->tab_label; |
5728 | |
5729 if (!GTK_WIDGET_MAPPED(tab)) | |
5730 continue; | |
5731 | |
5732 if (gtk_notebook_get_tab_pos(notebook) == GTK_POS_TOP || | |
5733 gtk_notebook_get_tab_pos(notebook) == GTK_POS_BOTTOM) { | |
5734 | |
5735 if (tab->allocation.x <= x_rel) { | |
5736 if (tab->allocation.x + (tab->allocation.width / 2) <= x_rel) | |
5737 page_num = i + 1; | |
5738 else | |
5739 page_num = i; | |
5740 } | |
5741 else | |
5742 break; | |
5743 } | |
5744 else { | |
5745 if (tab->allocation.y <= y_rel) { | |
5746 if (tab->allocation.y + (tab->allocation.height / 2) <= y_rel) | |
5747 page_num = i + 1; | |
5748 else | |
5749 page_num = i; | |
5750 } | |
5751 else | |
5752 break; | |
5753 } | |
5754 } | |
5755 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5756 if (i == gaim_conv_window_get_conversation_count(win) + 1) |
4359 | 5757 return -1; |
5758 | |
5759 return page_num; | |
5760 } | |
4940
3708545afe42
[gaim-migrate @ 5274]
Christian Hammond <chipx86@chipx86.com>
parents:
4939
diff
changeset
|
5761 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5762 static void |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5763 escape_closes_pref_cb(const char *name, GaimPrefType type, gpointer value, |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5764 gpointer data) |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5765 { |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5766 if (value) |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5767 gtk_accel_map_change_entry(N_("<main>/Conversation/Close"), |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5768 GDK_Escape, 0, TRUE); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5769 else |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5770 gtk_accel_map_change_entry(N_("<main>/Conversation/Close"), |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5771 GDK_W, GDK_CONTROL_MASK, TRUE); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5772 } |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5773 |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5774 static void |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5775 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
|
5776 gpointer data) |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5777 { |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5778 GList *l; |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5779 GaimConversation *conv; |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5780 GaimGtkConversation *gtkconv; |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5781 |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5782 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5783 conv = (GaimConversation *)l->data; |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5784 |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5785 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5786 continue; |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5787 |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5788 gtkconv = GAIM_GTK_CONVERSATION(conv); |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5789 |
6440 | 5790 if (value) { |
5791 update_tab_icon(conv); | |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5792 gtk_widget_show(gtkconv->icon); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
5793 gtk_widget_show(gtkconv->menu_icon); |
6440 | 5794 } |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
5795 else { |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5796 gtk_widget_hide(gtkconv->icon); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
5797 gtk_widget_hide(gtkconv->menu_icon); |
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
5798 } |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5799 } |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5800 } |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5801 |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5802 static void |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5803 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
|
5804 gpointer data) |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5805 { |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5806 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5807 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5808 GaimGtkConversation *gtkconv; |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5809 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5810 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5811 conv = (GaimConversation *)l->data; |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5812 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5813 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5814 continue; |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5815 |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5816 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5817 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5818 if (value) |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5819 gtk_widget_show(gtkconv->close); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5820 else |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5821 gtk_widget_hide(gtkconv->close); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5822 } |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5823 } |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5824 |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5825 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5826 show_timestamps_pref_cb(const char *name, GaimPrefType type, gpointer value, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5827 gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5828 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5829 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5830 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5831 GaimGtkConversation *gtkconv; |
5674
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 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5834 conv = (GaimConversation *)l->data; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5835 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5836 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5837 continue; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5838 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5839 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5840 |
7386 | 5841 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
|
5842 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5843 } |
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 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5846 spellcheck_pref_cb(const char *name, GaimPrefType type, gpointer value, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5847 gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5848 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5849 #ifdef USE_GTKSPELL |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5850 GList *cl; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5851 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5852 GaimGtkConversation *gtkconv; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5853 GtkSpell *spell; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5854 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5855 for (cl = gaim_get_conversations(); cl != NULL; cl = cl->next) { |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
5856 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5857 conv = (GaimConversation *)cl->data; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5858 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5859 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5860 continue; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5861 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5862 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5863 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5864 if (value) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
5865 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5866 else { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5867 spell = gtkspell_get_from_text_view(GTK_TEXT_VIEW(gtkconv->entry)); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5868 gtkspell_detach(spell); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5869 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5870 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5871 #endif |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5872 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5873 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5874 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5875 show_smileys_pref_cb(const char *name, GaimPrefType type, gpointer value, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5876 gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5877 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5878 GList *cl; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5879 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5880 GaimGtkConversation *gtkconv; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5881 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5882 for (cl = gaim_get_conversations(); cl != NULL; cl = cl->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5883 conv = (GaimConversation *)cl->data; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5884 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5885 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5886 continue; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5887 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5888 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5889 |
7386 | 5890 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
|
5891 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5892 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5893 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5894 static void |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5895 tab_side_pref_cb(const char *name, GaimPrefType type, gpointer value, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5896 gpointer data) |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5897 { |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5898 GList *l; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5899 GtkPositionType pos; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5900 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5901 GaimGtkWindow *gtkwin; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5902 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5903 pos = GPOINTER_TO_INT(value); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5904 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5905 for (l = gaim_get_windows(); l != NULL; l = l->next) { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5906 win = (GaimConvWindow *)l->data; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5907 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5908 if (!GAIM_IS_GTK_WINDOW(win)) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5909 continue; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5910 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5911 gtkwin = GAIM_GTK_WINDOW(win); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5912 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5913 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5914 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5915 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5916 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5917 static void |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5918 show_formatting_toolbar_pref_cb(const char *name, GaimPrefType type, |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5919 gpointer value, gpointer data) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5920 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5921 GList *l; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5922 GaimConversation *conv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5923 GaimGtkConversation *gtkconv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5924 GaimConvWindow *win; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5925 GaimGtkWindow *gtkwin; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5926 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5927 for (l = gaim_get_conversations(); l != NULL; l = l->next) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5928 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5929 conv = (GaimConversation *)l->data; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5930 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5931 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5932 continue; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5933 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5934 gtkconv = GAIM_GTK_CONVERSATION(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5935 win = gaim_conversation_get_window(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5936 gtkwin = GAIM_GTK_WINDOW(win); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5937 |
7386 | 5938 gtkconv->show_formatting_toolbar = (gboolean)GPOINTER_TO_INT(value); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5939 gtk_check_menu_item_set_active( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5940 GTK_CHECK_MENU_ITEM(gtkwin->menu.show_formatting_toolbar), |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5941 gtkconv->show_formatting_toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5942 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5943 if (gtkconv->show_formatting_toolbar) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5944 gtk_widget_show(gtkconv->toolbar.toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5945 else |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5946 gtk_widget_hide(gtkconv->toolbar.toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5947 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5948 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5949 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5950 static void |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5951 im_button_type_pref_cb(const char *name, GaimPrefType type, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5952 gpointer value, gpointer data) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5953 { |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5954 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5955 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5956 GaimGtkConversation *gtkconv; |
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 for (l = gaim_get_ims(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5959 conv = (GaimConversation *)l->data; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5960 gtkconv = GAIM_GTK_CONVERSATION(conv); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5961 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5962 setup_im_buttons(conv, gtk_widget_get_parent(gtkconv->send)); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5963 } |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5964 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5965 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5966 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5967 animate_buddy_icons_pref_cb(const char *name, GaimPrefType type, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5968 gpointer value, gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5969 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5970 GList *l; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5971 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5972 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
|
5973 return; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5974 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5975 if (value) { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5976 for (l = gaim_get_ims(); l != NULL; l = l->next) |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5977 start_anim(NULL, (GaimConversation *)l->data); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5978 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5979 else { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5980 for (l = gaim_get_ims(); l != NULL; l = l->next) |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5981 stop_anim(NULL, (GaimConversation *)l->data); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5982 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5983 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5984 |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5985 static void |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5986 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
|
5987 gpointer data) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5988 { |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5989 GList *l; |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5990 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5991 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5992 GaimConversation *conv = l->data; |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5993 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5994 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5995 gaim_conversation_foreach(gaim_gtkconv_update_buddy_icon); |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5996 } |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5997 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5998 |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5680
diff
changeset
|
5999 static void |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
6000 chat_button_type_pref_cb(const char *name, GaimPrefType type, |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
6001 gpointer value, gpointer data) |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6002 { |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6003 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6004 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
6005 GaimGtkConversation *gtkconv; |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
6006 |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
6007 for (l = gaim_get_chats(); l != NULL; l = l->next) { |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
6008 conv = (GaimConversation *)l->data; |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
6009 gtkconv = GAIM_GTK_CONVERSATION(conv); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
6010 |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
6011 setup_chat_buttons(conv, gtk_widget_get_parent(gtkconv->send)); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6012 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6013 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6014 |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6015 static void |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6016 conv_placement_pref_cb(const char *name, GaimPrefType type, |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6017 gpointer value, gpointer data) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6018 { |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6019 GaimConvPlacementFunc func; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6020 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6021 if (strcmp(name, "/gaim/gtk/conversations/placement")) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6022 return; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6023 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6024 func = gaim_conv_placement_get_fnc(value); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6025 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6026 if (func == NULL) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6027 return; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6028 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6029 gaim_conv_placement_set_current_func(func); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6030 } |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6031 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6032 void |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
6033 gaim_gtk_conversations_init(void) |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6034 { |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6035 /* Conversations */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6036 gaim_prefs_add_none("/gaim/gtk/conversations"); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
6037 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
|
6038 gaim_prefs_add_bool("/gaim/gtk/conversations/close_on_tabs", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6039 gaim_prefs_add_bool("/gaim/gtk/conversations/ctrl_enter_sends", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6040 gaim_prefs_add_bool("/gaim/gtk/conversations/enter_sends", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6041 gaim_prefs_add_bool("/gaim/gtk/conversations/escape_closes", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6042 gaim_prefs_add_bool("/gaim/gtk/conversations/send_bold", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6043 gaim_prefs_add_bool("/gaim/gtk/conversations/send_italic", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6044 gaim_prefs_add_bool("/gaim/gtk/conversations/send_strikethrough", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6045 gaim_prefs_add_bool("/gaim/gtk/conversations/send_underline", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6046 gaim_prefs_add_bool("/gaim/gtk/conversations/show_smileys", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6047 gaim_prefs_add_bool("/gaim/gtk/conversations/show_timestamps", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6048 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
|
6049 gaim_prefs_add_bool("/gaim/gtk/conversations/spellcheck", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6050 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_colors", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6051 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_fonts", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6052 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_font_sizes", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6053 gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_bgcolor", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6054 gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_fgcolor", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6055 gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_font", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6056 gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_size", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6057 gaim_prefs_add_bool("/gaim/gtk/conversations/html_shortcuts", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6058 gaim_prefs_add_bool("/gaim/gtk/conversations/smiley_shortcuts", FALSE); |
5743
af159a5bbaa0
[gaim-migrate @ 6167]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
6059 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
|
6060 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
|
6061 gaim_prefs_add_string("/gaim/gtk/conversations/placement", "last"); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6062 gaim_prefs_add_string("/gaim/gtk/conversations/bgcolor", "#FFFFFF"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6063 gaim_prefs_add_string("/gaim/gtk/conversations/fgcolor", "#000000"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6064 gaim_prefs_add_string("/gaim/gtk/conversations/font_face", ""); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6065 gaim_prefs_add_int("/gaim/gtk/conversations/font_size", 3); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6066 gaim_prefs_add_bool("/gaim/gtk/conversations/tabs", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6067 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
|
6068 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6069 /* Conversations -> Chat */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6070 gaim_prefs_add_none("/gaim/gtk/conversations/chat"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6071 gaim_prefs_add_int("/gaim/gtk/conversations/chat/button_type", |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6072 GAIM_BUTTON_TEXT_IMAGE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6073 gaim_prefs_add_bool("/gaim/gtk/conversations/chat/color_nicks", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6074 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
|
6075 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
|
6076 gaim_prefs_add_bool("/gaim/gtk/conversations/chat/tab_completion", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6077 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_width", 410); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6078 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_height", 160); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6079 gaim_prefs_add_int("/gaim/gtk/conversations/chat/entry_height", 50); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6080 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6081 /* Conversations -> IM */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6082 gaim_prefs_add_none("/gaim/gtk/conversations/im"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6083 gaim_prefs_add_int("/gaim/gtk/conversations/im/button_type", |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6084 GAIM_BUTTON_TEXT_IMAGE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6085 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
|
6086 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
|
6087 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
|
6088 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
|
6089 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_width", 410); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6090 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_height", 160); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6091 gaim_prefs_add_int("/gaim/gtk/conversations/im/entry_height", 50); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6092 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6093 /* Connect callbacks. */ |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6094 gaim_prefs_connect_callback("/gaim/gtk/conversations/escape_closes", |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6095 escape_closes_pref_cb, NULL); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
6096 gaim_prefs_connect_callback("/gaim/gtk/conversations/icons_on_tabs", |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
6097 icons_on_tabs_pref_cb, NULL); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6098 gaim_prefs_connect_callback("/gaim/gtk/conversations/close_on_tabs", |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6099 close_on_tabs_pref_cb, NULL); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6100 gaim_prefs_connect_callback("/gaim/gtk/conversations/show_smileys", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6101 show_smileys_pref_cb, NULL); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6102 gaim_prefs_connect_callback("/gaim/gtk/conversations/show_timestamps", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6103 show_timestamps_pref_cb, NULL); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6104 gaim_prefs_connect_callback("/gaim/gtk/conversations/show_formatting_toolbar", |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6105 show_formatting_toolbar_pref_cb, NULL); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6106 gaim_prefs_connect_callback("/gaim/gtk/conversations/spellcheck", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6107 spellcheck_pref_cb, NULL); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6108 gaim_prefs_connect_callback("/gaim/gtk/conversations/tab_side", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6109 tab_side_pref_cb, NULL); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6110 |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6111 gaim_prefs_connect_callback("/gaim/gtk/conversations/placement", |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6112 conv_placement_pref_cb, NULL); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6113 gaim_prefs_trigger_callback("/gaim/gtk/conversations/placement"); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6114 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6115 |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
6116 |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6117 /* IM callbacks */ |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6118 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/button_type", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6119 im_button_type_pref_cb, NULL); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6120 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/animate_buddy_icons", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6121 animate_buddy_icons_pref_cb, NULL); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6122 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/show_buddy_icons", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6123 show_buddy_icons_pref_cb, NULL); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6124 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6125 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6126 /* Chat callbacks */ |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6127 gaim_prefs_connect_callback("/gaim/gtk/conversations/chat/button_type", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6128 chat_button_type_pref_cb, NULL); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6129 } |