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