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