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