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