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