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