Mercurial > pidgin
annotate src/gtkconv.c @ 9443:3584cdab1d0b
[gaim-migrate @ 10264]
Use the INVITE stock button instead of OK on the Invite dialogs.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Fri, 02 Jul 2004 19:14:17 +0000 |
parents | e4654f277514 |
children | dbeca8eca296 |
rev | line source |
---|---|
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
1 /** |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
2 * @file gtkconv.h GTK+ Conversation API |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
3 * @ingroup gtkui |
4359 | 4 * |
8046 | 5 * Gaim is the legal property of its developers, whose names are too numerous |
6 * to list here. Please refer to the COPYRIGHT file distributed with this | |
7 * source distribution. | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
8 * |
4359 | 9 * This program is free software; you can redistribute it and/or modify |
10 * it under the terms of the GNU General Public License as published by | |
11 * the Free Software Foundation; either version 2 of the License, or | |
12 * (at your option) any later version. | |
13 * | |
14 * This program is distributed in the hope that it will be useful, | |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 * GNU General Public License for more details. | |
18 * | |
19 * You should have received a copy of the GNU General Public License | |
20 * along with this program; if not, write to the Free Software | |
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
22 * | |
23 */ | |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
24 #include "gtkinternal.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
25 |
4359 | 26 #ifndef _WIN32 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
27 # include <X11/Xlib.h> |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
28 #endif |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
29 |
4359 | 30 #ifdef USE_GTKSPELL |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
31 # include <gtkspell/gtkspell.h> |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
32 # ifdef _WIN32 |
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
33 # include "wspell.h" |
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
34 # endif |
4359 | 35 #endif |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
36 |
4359 | 37 #include <gdk/gdkkeysyms.h> |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
38 |
9130 | 39 #include "cmds.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
40 #include "debug.h" |
6982 | 41 #include "imgstore.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
42 #include "log.h" |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5402
diff
changeset
|
43 #include "notify.h" |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
44 #include "prefs.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
45 #include "prpl.h" |
6038 | 46 #include "request.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
47 #include "sound.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
48 #include "util.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
49 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
50 #include "dnd-hints.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
51 #include "gtkblist.h" |
5717 | 52 #include "gtkconv.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
53 #include "gtkimhtml.h" |
8317 | 54 #include "gtkimhtmltoolbar.h" |
7431 | 55 #include "gtklog.h" |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
56 #include "gtkpounce.h" |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
57 #include "gtkprivacy.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
58 #include "gtkutils.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
59 #include "stock.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
60 |
5717 | 61 #include "ui.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
62 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
63 /* XXX */ |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
64 #include "gaim.h" |
4359 | 65 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
66 #define AUTO_RESPONSE "<AUTO-REPLY> : " |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
67 |
7990 | 68 #define SEND_COLOR "#16569E" |
7855 | 69 #define RECV_COLOR "#A82F2F" |
7854 | 70 |
4359 | 71 static char nick_colors[][8] = { |
72 "#ba55d3", /* Medium Orchid */ | |
73 "#ee82ee", /* Violet */ | |
74 "#c715b4", /* Medium Violet Red */ | |
75 "#ff69b4", /* Hot Pink */ | |
76 "#ff6347", /* Tomato */ | |
77 "#fa8c00", /* Dark Orange */ | |
78 "#fa8072", /* Salmon */ | |
79 "#b22222", /* Fire Brick */ | |
80 "#f4a460", /* Sandy Brown */ | |
81 "#cd5c5c", /* Indian Red */ | |
82 "#bc8f8f", /* Rosy Brown */ | |
83 "#f0e68c", /* Khaki */ | |
84 "#bdb76b", /* Dark Khaki */ | |
85 "#228b22", /* Forest Green */ | |
86 "#9acd32", /* Yellow Green */ | |
87 "#32cd32", /* Lime Green */ | |
7755 | 88 "#3cb371", /* Medium Sea Green (Medium Sea Green?! What are we women?!) */ |
4359 | 89 "#2e8b57", /* Sea Green */ |
90 "#8fbc8f", /* Dark Sea Green */ | |
91 "#66cdaa", /* Medium Aquamarine */ | |
92 "#5f9ea0", /* Cadet Blue */ | |
93 "#48d1cc", /* Medium Turquoise */ | |
94 "#00ced1", /* Dark Turquoise */ | |
95 "#4682b4", /* Stell Blue */ | |
96 "#00bfff", /* Deep Sky Blue */ | |
97 "#1690ff", /* Dodger Blue */ | |
98 "#4169ff", /* Royal Blue */ | |
99 "#6a5acd", /* Slate Blue */ | |
100 "#6495ed", /* Cornflower Blue */ | |
101 "#708090", /* Slate gray */ | |
7995
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
102 "#2f4f4f", /* Dark Slate Gray */ |
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
103 "#ff8c00", /* Dark Orange */ |
8535 | 104 "#006400", /* DarkGreen */ |
105 "#8b4513", /* SaddleBrown */ | |
106 "#8b8989", /* snow4 */ | |
107 "#7d26cd", /* purple3 */ | |
4359 | 108 }; |
6291 | 109 |
4359 | 110 #define NUM_NICK_COLORS (sizeof(nick_colors) / sizeof(*nick_colors)) |
111 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
112 typedef struct |
4359 | 113 { |
114 GtkWidget *window; | |
115 | |
116 GtkWidget *entry; | |
117 GtkWidget *message; | |
118 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
119 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
120 |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
121 } InviteBuddyInfo; |
4359 | 122 |
123 static GtkWidget *invite_dialog = NULL; | |
124 | |
125 /* Prototypes. <-- because Paco-Paco hates this comment. */ | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
126 static void got_typing_keypress(GaimConversation *conv, gboolean first); |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
127 static GList *generate_invite_user_names(GaimConnection *gc); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
128 static void add_chat_buddy_common(GaimConversation *conv, |
4359 | 129 const char *name, int pos); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
130 static void tab_complete(GaimConversation *conv); |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
131 static void update_typing_icon(GaimConversation *conv); |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
132 static gboolean update_send_as_selection(GaimConvWindow *win); |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
133 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
|
134 static void save_convo(GtkWidget *save, GaimConversation *c); |
4359 | 135 |
136 /************************************************************************** | |
137 * Callbacks | |
138 **************************************************************************/ | |
139 static void | |
6038 | 140 do_save_convo(GtkWidget *wid) |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
141 { |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
142 GaimConversation *conv; |
8557 | 143 const char *name; |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
144 const char *filename; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
145 FILE *fp; |
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 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
|
148 "gaim_conversation"); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
149 |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
150 filename = gtk_file_selection_get_filename(GTK_FILE_SELECTION(wid)); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
151 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
152 if (!((gaim_conversation_get_type(conv) != GAIM_CONV_CHAT && |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
153 g_list_find(gaim_get_ims(), conv)) || |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
154 (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT && |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
155 g_list_find(gaim_get_chats(), conv)))) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
156 filename = NULL; |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
157 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
158 gtk_widget_destroy(wid); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
159 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
160 if (filename == NULL) |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
161 return; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
162 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
163 if ((fp = fopen(filename, "w+")) == NULL) |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
164 return; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
165 |
8557 | 166 name = gaim_conversation_get_name(conv); |
167 | |
168 fprintf(fp, _("<h1>Conversation with %s</h1>\n"), name); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
169 fprintf(fp, "%s", conv->history->str); |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
170 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
171 fclose(fp); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
172 } |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
173 |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
174 static void |
6038 | 175 do_check_save_convo(GObject *obj, GtkWidget *wid) |
176 { | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
177 const char *filename; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
178 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
179 filename = gtk_file_selection_get_filename(GTK_FILE_SELECTION(wid)); |
6038 | 180 |
181 if (gaim_gtk_check_if_dir(filename, GTK_FILE_SELECTION(wid))) | |
182 return; | |
183 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
184 if (g_file_test(filename, G_FILE_TEST_EXISTS)) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
185 { |
6038 | 186 gaim_request_yes_no(NULL, NULL, _("That file already exists"), |
187 _("Would you like to overwrite it?"), 1, wid, | |
188 G_CALLBACK(do_save_convo), NULL); | |
189 } | |
190 else | |
191 do_save_convo(wid); | |
192 } | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6460
diff
changeset
|
193 |
4359 | 194 |
195 static gint | |
196 close_win_cb(GtkWidget *w, GdkEventAny *e, gpointer d) | |
197 { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
198 GaimConvWindow *win = (GaimConvWindow *)d; |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
199 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
200 gaim_conv_window_destroy(win); |
4361
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
201 |
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
202 return TRUE; |
4359 | 203 } |
204 | |
205 static gint | |
206 close_conv_cb(GtkWidget *w, gpointer d) | |
207 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
208 GaimConversation *conv = (GaimConversation *)d; |
4359 | 209 |
210 gaim_conversation_destroy(conv); | |
4361
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
211 |
25d5b2a7545f
[gaim-migrate @ 4627]
Christian Hammond <chipx86@chipx86.com>
parents:
4360
diff
changeset
|
212 return TRUE; |
4359 | 213 } |
214 | |
8914 | 215 static gboolean |
216 size_allocate_cb(GtkWidget *w, GtkAllocation *allocation, GaimConversation *conv) | |
217 { | |
218 GaimGtkConversation *gtkconv; | |
9048 | 219 GaimConvWindow *win = gaim_conversation_get_window(conv); |
8914 | 220 |
221 if (!GTK_WIDGET_VISIBLE(w)) | |
222 return FALSE; | |
223 | |
224 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
225 return FALSE; | |
226 | |
227 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
228 | |
9048 | 229 /* I find that I resize the window when it has a bunch of conversations in it, mostly so that the tab bar |
230 * will fit, but then I don't want new windows taking up the entire screen. I check to see if there is only one | |
231 * conversation in the window. This way we'll be setting new windows to the size of the last resized new window. */ | |
232 | |
8914 | 233 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
234 { | |
9048 | 235 if (w == gtkconv->sw && (gaim_conv_window_get_conversation_count(win) == 1)) |
8914 | 236 { |
237 gaim_prefs_set_int("/gaim/gtk/conversations/im/default_width", allocation->width); | |
238 gaim_prefs_set_int("/gaim/gtk/conversations/im/default_height", allocation->height); | |
239 } | |
240 if (w == gtkconv->entry) | |
241 gaim_prefs_set_int("/gaim/gtk/conversations/im/entry_height", allocation->height); | |
242 } | |
243 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
244 { | |
9048 | 245 if (w == gtkconv->sw && (gaim_conv_window_get_conversation_count(win) == 1)) |
8914 | 246 { |
247 gaim_prefs_set_int("/gaim/gtk/conversations/chat/default_width", allocation->width); | |
248 gaim_prefs_set_int("/gaim/gtk/conversations/chat/default_height", allocation->height); | |
249 } | |
250 if (w == gtkconv->entry) | |
251 gaim_prefs_set_int("/gaim/gtk/conversations/chat/entry_height", allocation->height); | |
252 } | |
253 | |
254 return FALSE; | |
255 } | |
256 | |
7446
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
257 /* Courtesy of Galeon! */ |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
258 static void |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
259 tab_close_button_state_changed_cb(GtkWidget *widget, GtkStateType prev_state) |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
260 { |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
261 if (GTK_WIDGET_STATE(widget) == GTK_STATE_ACTIVE) |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
262 gtk_widget_set_state(widget, GTK_STATE_NORMAL); |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
263 } |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
264 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
265 static void |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
266 default_formatize(GaimConversation *conv) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
267 { |
8061 | 268 GaimGtkConversation *c = GAIM_GTK_CONVERSATION(conv); |
269 GaimConnection *gc = gaim_conversation_get_gc(conv); | |
8407
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 if (gc && gc->flags & GAIM_CONNECTION_HTML) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
272 { |
9025 | 273 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_formatting")) |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
274 { |
9025 | 275 char *color; |
276 GdkColor fg_color, bg_color; | |
277 | |
278 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold")) | |
279 gtk_imhtml_toggle_bold(GTK_IMHTML(c->entry)); | |
280 | |
281 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic")) | |
282 gtk_imhtml_toggle_italic(GTK_IMHTML(c->entry)); | |
283 | |
284 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline")) | |
285 gtk_imhtml_toggle_underline(GTK_IMHTML(c->entry)); | |
286 | |
287 gtk_imhtml_toggle_fontface(GTK_IMHTML(c->entry), | |
288 gaim_prefs_get_string("/gaim/gtk/conversations/font_face")); | |
289 | |
290 if (!(gc->flags & GAIM_CONNECTION_NO_FONTSIZE)) | |
291 gtk_imhtml_font_set_size(GTK_IMHTML(c->entry), | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
292 gaim_prefs_get_int("/gaim/gtk/conversations/font_size")); |
9025 | 293 |
294 if(strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"), "") != 0) | |
295 { | |
296 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"), | |
297 &fg_color); | |
298 color = g_strdup_printf("#%02x%02x%02x", | |
299 fg_color.red / 256, | |
300 fg_color.green / 256, | |
301 fg_color.blue / 256); | |
302 } | |
303 else | |
304 color = g_strdup(""); | |
305 | |
8061 | 306 gtk_imhtml_toggle_forecolor(GTK_IMHTML(c->entry), color); |
307 g_free(color); | |
9025 | 308 |
309 if(!(gc->flags & GAIM_CONNECTION_NO_BGCOLOR) && | |
310 strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), "") != 0) | |
311 { | |
312 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), | |
313 &bg_color); | |
314 color = g_strdup_printf("#%02x%02x%02x", | |
315 bg_color.red / 256, | |
316 bg_color.green / 256, | |
317 bg_color.blue / 256); | |
318 } | |
319 else | |
320 color = g_strdup(""); | |
321 | |
8061 | 322 gtk_imhtml_toggle_backcolor(GTK_IMHTML(c->entry), color); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
323 g_free(color); |
8061 | 324 } |
8677 | 325 |
9025 | 326 |
8677 | 327 if (gc->flags & GAIM_CONNECTION_FORMATTING_WBFO) |
328 gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(c->entry), TRUE); | |
329 else | |
330 gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(c->entry), FALSE); | |
8061 | 331 } |
332 } | |
9130 | 333 |
334 static const char * | |
335 gaim_gtk_get_cmd_prefix(void) | |
336 { | |
337 return "/"; | |
338 } | |
339 | |
9167 | 340 static GaimCmdRet |
341 me_command_cb(GaimConversation *conv, | |
342 const char *cmd, char **args, char **error) | |
343 { | |
344 char *tmp; | |
345 | |
346 tmp = g_strdup_printf("/me %s", args[0]); | |
9175 | 347 |
9167 | 348 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
349 gaim_conv_im_send(GAIM_CONV_IM(conv), tmp); | |
350 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
351 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), tmp); | |
352 | |
353 g_free(tmp); | |
354 return GAIM_CMD_RET_OK; | |
355 } | |
356 | |
9212 | 357 static GaimCmdRet |
358 debug_command_cb(GaimConversation *conv, | |
359 const char *cmd, char **args, char **error) | |
360 { | |
361 char *tmp, *markup; | |
362 GaimCmdStatus status; | |
363 | |
364 if (!g_ascii_strcasecmp(args[0], "version")) { | |
365 tmp = g_strdup_printf(_("me is using Gaim v%s."), VERSION); | |
366 markup = gaim_escape_html(tmp); | |
367 | |
368 status = gaim_cmd_do_command(conv, tmp, markup, error); | |
369 | |
370 g_free(tmp); | |
371 g_free(markup); | |
372 return status; | |
373 } else { | |
374 gaim_conversation_write(conv, NULL, _("Supported debug options are: version"), | |
375 GAIM_MESSAGE_NO_LOG|GAIM_MESSAGE_ERROR, time(NULL)); | |
376 return GAIM_CMD_STATUS_OK; | |
377 } | |
378 } | |
379 | |
9213 | 380 static GaimCmdRet |
381 help_command_cb(GaimConversation *conv, | |
382 const char *cmd, char **args, char **error) | |
383 { | |
384 GString *s; | |
385 GList *cmds, *l; | |
386 | |
387 s = g_string_new(_("Use \"/help <command>\" for help on a specific command.\n" | |
388 "The following commands are available in this context:\n")); | |
389 | |
390 cmds = gaim_cmd_list(conv); | |
391 for (l = cmds; l; l = l->next) | |
392 if (l->next) | |
393 g_string_append_printf(s, "%s, ", (char *)l->data); | |
394 else | |
395 g_string_append_printf(s, "%s.", (char *)l->data); | |
396 | |
397 gaim_conversation_write(conv, NULL, s->str, GAIM_MESSAGE_NO_LOG, time(NULL)); | |
398 g_string_free(s, TRUE); | |
399 g_list_free(cmds); | |
400 | |
401 return GAIM_CMD_STATUS_OK; | |
402 } | |
403 | |
404 static GaimCmdRet | |
405 help_arg_command_cb(GaimConversation *conv, | |
406 const char *cmd, char **args, char **error) | |
407 { | |
408 GList *help, *l; | |
409 GString *s; | |
410 | |
411 s = g_string_new(""); | |
412 help = gaim_cmd_help(conv, args[0]); | |
413 | |
414 if (help) { | |
415 for (l = help; l; l = l->next) | |
416 if (l->next) | |
9247 | 417 g_string_append_printf(s, "/%s\n", (char *)l->data); |
9213 | 418 else |
9247 | 419 g_string_append_printf(s, "/%s", (char *)l->data); |
9213 | 420 } else { |
421 g_string_append(s, _("No such command (in this context).")); | |
422 } | |
423 | |
424 gaim_conversation_write(conv, NULL, s->str, GAIM_MESSAGE_NO_LOG, time(NULL)); | |
425 g_string_free(s, TRUE); | |
426 g_list_free(help); | |
427 | |
428 return GAIM_CMD_STATUS_OK; | |
429 } | |
430 | |
4359 | 431 static void |
9374 | 432 send_history_add(GaimConversation *conv, const char *message) |
433 { | |
434 GList *first; | |
435 | |
436 first = g_list_first(conv->send_history); | |
437 | |
438 if (first->data) | |
439 g_free(first->data); | |
440 | |
441 first->data = g_strdup(message); | |
442 | |
443 conv->send_history = g_list_prepend(first, NULL); | |
444 } | |
445 | |
446 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
447 send_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 448 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
449 GaimGtkConversation *gtkconv; |
9130 | 450 char *cmd; |
451 const char *prefix; | |
8655 | 452 GaimAccount *account; |
8677 | 453 GaimConnection *gc; |
8448 | 454 char *buf, *clean; |
4359 | 455 |
456 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
8655 | 457 account = gaim_conversation_get_account(conv); |
9130 | 458 prefix = gaim_gtk_get_cmd_prefix(); |
459 | |
460 if(gaim_prefs_get_bool("/gaim/gtk/conversations/enable_commands")) { | |
461 cmd = gtk_imhtml_get_text(GTK_IMHTML(gtkconv->entry), NULL, NULL); | |
462 if(cmd && (strncmp(cmd, prefix, strlen(prefix)) == 0)) { | |
463 GaimCmdStatus status; | |
9374 | 464 char *error, *cmdline, *markup, *send_history; |
9175 | 465 GtkTextIter start, end; |
9130 | 466 |
9374 | 467 send_history = gtk_imhtml_get_markup(GTK_IMHTML(gtkconv->entry)); |
468 send_history_add(conv, send_history); | |
469 g_free(send_history); | |
470 | |
9130 | 471 cmdline = cmd + strlen(prefix); |
9175 | 472 gtk_text_buffer_get_start_iter(GTK_IMHTML(gtkconv->entry)->text_buffer, &start); |
473 gtk_text_iter_forward_chars(&start, g_utf8_strlen(prefix, -1)); | |
474 gtk_text_buffer_get_end_iter(GTK_IMHTML(gtkconv->entry)->text_buffer, &end); | |
475 markup = gtk_imhtml_get_markup_range(GTK_IMHTML(gtkconv->entry), &start, &end); | |
476 status = gaim_cmd_do_command(conv, cmdline, markup, &error); | |
9130 | 477 g_free(cmd); |
9175 | 478 g_free(markup); |
9130 | 479 |
480 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); | |
481 default_formatize(conv); | |
482 | |
483 switch(status) { | |
484 case GAIM_CMD_STATUS_OK: | |
485 return; | |
486 case GAIM_CMD_STATUS_NOT_FOUND: | |
9212 | 487 gaim_conversation_write(conv, "", _("No such command. If you didn't mean " |
488 "to type a command, you can turn " | |
489 "commands off from Tools->" | |
490 "Preferences->Interface->Conversation" | |
491 "->Enable \"slash\" commands."), | |
9213 | 492 GAIM_MESSAGE_NO_LOG, time(NULL)); |
9130 | 493 return; |
494 case GAIM_CMD_STATUS_WRONG_ARGS: | |
9212 | 495 gaim_conversation_write(conv, "", _("Syntax Error: You typed the wrong number of arguments " |
496 "to that command. If you didn't mean to type a command, " | |
497 "you can turn commands off from Tools->Preferences->" | |
498 "Interface->Conversation->Enable \"slash\" commands."), | |
9213 | 499 GAIM_MESSAGE_NO_LOG, time(NULL)); |
9130 | 500 return; |
501 case GAIM_CMD_STATUS_FAILED: | |
9212 | 502 gaim_conversation_write(conv, "", error ? error : _("Your command failed for an unknown reason."), |
9213 | 503 GAIM_MESSAGE_NO_LOG, time(NULL)); |
9130 | 504 if(error) |
505 g_free(error); | |
506 return; | |
507 case GAIM_CMD_STATUS_WRONG_TYPE: | |
508 if(gaim_conversation_get_type(conv) == GAIM_CONV_IM) | |
509 gaim_conversation_write(conv, "", _("That command only works in Chats, not IMs."), | |
9213 | 510 GAIM_MESSAGE_NO_LOG, time(NULL)); |
9130 | 511 else |
512 gaim_conversation_write(conv, "", _("That command only works in IMs, not Chats."), | |
9213 | 513 GAIM_MESSAGE_NO_LOG, time(NULL)); |
9130 | 514 return; |
515 case GAIM_CMD_STATUS_WRONG_PRPL: | |
516 gaim_conversation_write(conv, "", _("That command doesn't work on this protocol."), | |
9213 | 517 GAIM_MESSAGE_NO_LOG, time(NULL)); |
9130 | 518 return; |
519 } | |
520 } | |
521 | |
522 g_free(cmd); | |
523 } | |
524 | |
8655 | 525 |
526 if (!gaim_account_is_connected(account)) | |
527 return; | |
8329
9dd7c75ed433
[gaim-migrate @ 9053]
Christian Hammond <chipx86@chipx86.com>
parents:
8319
diff
changeset
|
528 |
8442 | 529 buf = gtk_imhtml_get_markup(GTK_IMHTML(gtkconv->entry)); |
8962 | 530 clean = gtk_imhtml_get_text(GTK_IMHTML(gtkconv->entry), NULL, NULL); |
8448 | 531 |
4359 | 532 gtk_widget_grab_focus(gtkconv->entry); |
533 | |
8448 | 534 if (strlen(clean) == 0) { |
535 g_free(clean); | |
4359 | 536 return; |
537 } | |
538 | |
8677 | 539 gc = gaim_account_get_connection(account); |
540 if (gc && (gc->flags & GAIM_CONNECTION_NO_NEWLINES)) { | |
541 char **bufs; | |
542 int i; | |
543 | |
544 bufs = gtk_imhtml_get_markup_lines(GTK_IMHTML(gtkconv->entry)); | |
545 for (i = 0; bufs[i]; i++) { | |
9374 | 546 send_history_add(conv, bufs[i]); |
8677 | 547 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
548 gaim_conv_im_send(GAIM_CONV_IM(conv), bufs[i]); | |
549 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
550 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), bufs[i]); | |
551 } | |
552 | |
553 g_strfreev(bufs); | |
554 | |
555 } else { | |
9374 | 556 send_history_add(conv, buf); |
8677 | 557 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
558 gaim_conv_im_send(GAIM_CONV_IM(conv), buf); | |
559 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
560 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), buf); | |
561 } | |
4359 | 562 |
8677 | 563 g_free(clean); |
4359 | 564 g_free(buf); |
565 | |
8061 | 566 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); |
567 default_formatize(conv); | |
4359 | 568 } |
569 | |
570 static void | |
7928 | 571 add_remove_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 572 { |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
573 GaimAccount *account; |
4359 | 574 const char *name; |
575 | |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
576 account = gaim_conversation_get_account(conv); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
577 name = gaim_conversation_get_name(conv); |
7879 | 578 |
579 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
7859 | 580 GaimBuddy *b; |
581 | |
582 b = gaim_find_buddy(account, name); | |
583 if (b != NULL) | |
584 show_confirm_del(b); | |
585 else if (account != NULL && gaim_account_is_connected(account)) | |
586 gaim_blist_request_add_buddy(account, (char *)name, NULL, NULL); | |
7879 | 587 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
7859 | 588 GaimChat *c; |
589 | |
590 c = gaim_blist_find_chat(account, name); | |
591 if (c != NULL) | |
592 show_confirm_del_blist_chat(c); | |
593 else if (account != NULL && gaim_account_is_connected(account)) | |
594 gaim_blist_request_add_chat(account, NULL, NULL); | |
595 } | |
4359 | 596 |
597 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
598 } | |
599 | |
7975 | 600 static void chat_do_info(GaimConversation *conv, const char *who) |
601 { | |
602 GaimPluginProtocolInfo *prpl_info = NULL; | |
603 GaimConnection *gc; | |
604 | |
605 if ((gc = gaim_conversation_get_gc(conv))) { | |
606 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | |
607 | |
608 /* | |
609 * If there are special needs for getting info on users in | |
610 * buddy chat "rooms"... | |
611 */ | |
612 if (prpl_info->get_cb_info != NULL) | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
613 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
614 prpl_info->get_cb_info(gc, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
615 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
616 } |
7975 | 617 else |
618 prpl_info->get_info(gc, who); | |
619 } | |
620 } | |
621 | |
622 | |
4359 | 623 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
624 info_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 625 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
626 GaimGtkConversation *gtkconv; |
4359 | 627 |
628 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
629 | |
7879 | 630 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
631 serv_get_info(gaim_conversation_get_gc(conv), | |
632 gaim_conversation_get_name(conv)); | |
633 | |
634 gtk_widget_grab_focus(gtkconv->entry); | |
635 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
636 /* Get info of the person currently selected in the GtkTreeView */ | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
637 GaimGtkChatPane *gtkchat; |
4359 | 638 GtkTreeIter iter; |
639 GtkTreeModel *model; | |
640 GtkTreeSelection *sel; | |
641 const char *name; | |
642 | |
643 gtkchat = gtkconv->u.chat; | |
644 | |
645 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | |
646 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); | |
647 | |
648 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) | |
649 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &name, -1); | |
650 else | |
651 return; | |
652 | |
7975 | 653 chat_do_info(conv, name); |
4359 | 654 } |
655 } | |
656 | |
657 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
658 warn_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 659 { |
660 show_warn_dialog(gaim_conversation_get_gc(conv), | |
7879 | 661 gaim_conversation_get_name(conv)); |
4359 | 662 |
663 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
664 } | |
665 | |
666 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
667 block_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 668 { |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
669 GaimAccount *account; |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
670 |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
671 account = gaim_conversation_get_account(conv); |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
672 |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6291
diff
changeset
|
673 if (account != NULL && gaim_account_is_connected(account)) |
6399
d726a36628e8
[gaim-migrate @ 6904]
Christian Hammond <chipx86@chipx86.com>
parents:
6398
diff
changeset
|
674 gaim_gtk_request_add_block(account, gaim_conversation_get_name(conv)); |
4359 | 675 |
676 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); | |
677 } | |
678 | |
679 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
680 do_invite(GtkWidget *w, int resp, InviteBuddyInfo *info) |
4359 | 681 { |
682 const char *buddy, *message; | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
683 GaimGtkConversation *gtkconv; |
4359 | 684 |
685 gtkconv = GAIM_GTK_CONVERSATION(info->conv); | |
686 | |
687 if (resp == GTK_RESPONSE_OK) { | |
688 buddy = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(info->entry)->entry)); | |
689 message = gtk_entry_get_text(GTK_ENTRY(info->message)); | |
690 | |
4793 | 691 if (!g_ascii_strcasecmp(buddy, "")) { |
4359 | 692 g_free(info); |
693 | |
694 return; | |
695 } | |
696 | |
697 serv_chat_invite(gaim_conversation_get_gc(info->conv), | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
698 gaim_conv_chat_get_id(GAIM_CONV_CHAT(info->conv)), |
4359 | 699 message, buddy); |
700 } | |
701 | |
702 gtk_widget_destroy(invite_dialog); | |
703 invite_dialog = NULL; | |
704 | |
705 g_free(info); | |
706 } | |
707 | |
708 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
709 invite_cb(GtkWidget *widget, GaimConversation *conv) |
4359 | 710 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
711 InviteBuddyInfo *info = NULL; |
4359 | 712 |
713 if (invite_dialog == NULL) { | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
714 GaimConnection *gc; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
715 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
716 GaimGtkWindow *gtkwin; |
4359 | 717 GtkWidget *label; |
718 GtkWidget *vbox, *hbox; | |
719 GtkWidget *table; | |
720 GtkWidget *img; | |
721 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
722 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
723 GTK_ICON_SIZE_DIALOG); |
4359 | 724 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
725 info = g_new0(InviteBuddyInfo, 1); |
4359 | 726 info->conv = conv; |
727 | |
728 gc = gaim_conversation_get_gc(conv); | |
729 win = gaim_conversation_get_window(conv); | |
730 gtkwin = GAIM_GTK_WINDOW(win); | |
731 | |
732 /* Create the new dialog. */ | |
733 invite_dialog = gtk_dialog_new_with_buttons( | |
7859 | 734 _("Invite Buddy Into Chat Room"), |
7879 | 735 GTK_WINDOW(gtkwin->window), 0, |
736 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, | |
9443
3584cdab1d0b
[gaim-migrate @ 10264]
Christian Hammond <chipx86@chipx86.com>
parents:
9374
diff
changeset
|
737 GAIM_STOCK_INVITE, GTK_RESPONSE_OK, NULL); |
4359 | 738 |
739 gtk_dialog_set_default_response(GTK_DIALOG(invite_dialog), | |
740 GTK_RESPONSE_OK); | |
741 gtk_container_set_border_width(GTK_CONTAINER(invite_dialog), 6); | |
742 gtk_window_set_resizable(GTK_WINDOW(invite_dialog), FALSE); | |
743 gtk_dialog_set_has_separator(GTK_DIALOG(invite_dialog), FALSE); | |
744 | |
745 /* Setup the outside spacing. */ | |
746 vbox = GTK_DIALOG(invite_dialog)->vbox; | |
747 | |
748 gtk_box_set_spacing(GTK_BOX(vbox), 12); | |
749 gtk_container_set_border_width(GTK_CONTAINER(vbox), 6); | |
750 | |
751 /* Setup the inner hbox and put the dialog's icon in it. */ | |
752 hbox = gtk_hbox_new(FALSE, 12); | |
753 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
754 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
755 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
756 | |
757 /* Setup the right vbox. */ | |
758 vbox = gtk_vbox_new(FALSE, 0); | |
759 gtk_container_add(GTK_CONTAINER(hbox), vbox); | |
760 | |
761 /* Put our happy label in it. */ | |
762 label = gtk_label_new(_("Please enter the name of the user you wish " | |
763 "to invite, along with an optional invite " | |
764 "message.")); | |
765 gtk_widget_set_size_request(label, 350, -1); | |
766 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
767 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
768 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
769 | |
770 /* hbox for the table, and to give it some spacing on the left. */ | |
771 hbox = gtk_hbox_new(FALSE, 6); | |
772 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
773 | |
774 /* Setup the table we're going to use to lay stuff out. */ | |
775 table = gtk_table_new(2, 2, FALSE); | |
776 gtk_table_set_row_spacings(GTK_TABLE(table), 6); | |
777 gtk_table_set_col_spacings(GTK_TABLE(table), 6); | |
778 gtk_container_set_border_width(GTK_CONTAINER(table), 12); | |
779 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); | |
780 | |
781 /* Now the Buddy label */ | |
782 label = gtk_label_new(NULL); | |
783 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Buddy:")); | |
784 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
785 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); | |
786 | |
787 /* Now the Buddy drop-down entry field. */ | |
788 info->entry = gtk_combo_new(); | |
789 gtk_combo_set_case_sensitive(GTK_COMBO(info->entry), FALSE); | |
790 gtk_entry_set_activates_default( | |
791 GTK_ENTRY(GTK_COMBO(info->entry)->entry), TRUE); | |
792 | |
793 gtk_table_attach_defaults(GTK_TABLE(table), info->entry, 1, 2, 0, 1); | |
794 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->entry); | |
795 | |
796 /* Fill in the names. */ | |
797 gtk_combo_set_popdown_strings(GTK_COMBO(info->entry), | |
798 generate_invite_user_names(gc)); | |
799 | |
800 | |
801 /* Now the label for "Message" */ | |
802 label = gtk_label_new(NULL); | |
803 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Message:")); | |
804 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
805 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); | |
806 | |
807 | |
808 /* And finally, the Message entry field. */ | |
809 info->message = gtk_entry_new(); | |
810 gtk_entry_set_activates_default(GTK_ENTRY(info->message), TRUE); | |
811 | |
812 gtk_table_attach_defaults(GTK_TABLE(table), info->message, 1, 2, 1, 2); | |
813 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->message); | |
814 | |
815 /* Connect the signals. */ | |
816 g_signal_connect(G_OBJECT(invite_dialog), "response", | |
817 G_CALLBACK(do_invite), info); | |
818 } | |
819 | |
820 gtk_widget_show_all(invite_dialog); | |
821 | |
822 if (info != NULL) | |
823 gtk_widget_grab_focus(GTK_COMBO(info->entry)->entry); | |
824 } | |
825 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
826 static void |
7748 | 827 menu_new_conv_cb(gpointer data, guint action, GtkWidget *widget) |
828 { | |
829 show_im_dialog(); | |
830 } | |
831 | |
832 static void | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
833 menu_save_as_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
834 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
835 GaimConvWindow *win = (GaimConvWindow *)data; |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
836 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
837 save_convo(NULL, gaim_conv_window_get_active_conversation(win)); |
5908
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 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
840 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
841 menu_view_log_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
842 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
843 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
844 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
845 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
846 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
847 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
848 gaim_gtk_log_show((char *)gaim_conversation_get_name(conv), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
849 gaim_conversation_get_account(conv)); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
850 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
851 |
8974 | 852 static void |
853 menu_clear_cb(gpointer data, guint action, GtkWidget *widget) | |
854 { | |
855 GaimConvWindow *win = (GaimConvWindow *)data; | |
856 GaimConversation *conv; | |
857 GaimGtkConversation *gtkconv; | |
858 | |
859 conv = gaim_conv_window_get_active_conversation(win); | |
860 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
861 | |
862 gtk_imhtml_clear(GTK_IMHTML(gtkconv->imhtml)); | |
863 g_string_free(conv->history, TRUE); | |
864 conv->history = g_string_new(""); | |
865 } | |
866 | |
7295 | 867 struct _search { |
868 GaimGtkConversation *gtkconv; | |
869 GtkWidget *entry; | |
870 }; | |
871 | |
7929 | 872 static void do_search_cb(GtkWidget *widget, gint resp, struct _search *s) |
7295 | 873 { |
7929 | 874 switch (resp) { |
875 case GTK_RESPONSE_OK: | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
876 gtk_imhtml_search_find(GTK_IMHTML(s->gtkconv->imhtml), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
877 gtk_entry_get_text(GTK_ENTRY(s->entry))); |
7929 | 878 break; |
879 | |
880 case GTK_RESPONSE_DELETE_EVENT: | |
881 case GTK_RESPONSE_CLOSE: | |
882 gtk_imhtml_search_clear(GTK_IMHTML(s->gtkconv->imhtml)); | |
883 gtk_widget_destroy(s->gtkconv->dialogs.search); | |
884 s->gtkconv->dialogs.search = NULL; | |
885 g_free(s); | |
886 break; | |
887 } | |
7295 | 888 } |
889 | |
890 static void | |
7751 | 891 menu_find_cb(gpointer data, guint action, GtkWidget *widget) |
7295 | 892 { |
893 GaimConvWindow *win = (GaimConvWindow *)data; | |
894 GaimConversation *conv = gaim_conv_window_get_active_conversation(win); | |
895 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); | |
896 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7929 | 897 GtkWidget *hbox; |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
898 GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
899 GTK_ICON_SIZE_DIALOG); |
7929 | 900 GtkWidget *label; |
7295 | 901 struct _search *s; |
902 | |
7798 | 903 if (gtkconv->dialogs.search) { |
904 gtk_window_present(GTK_WINDOW(gtkconv->dialogs.search)); | |
7295 | 905 return; |
7798 | 906 } |
7300
41bbe5534441
[gaim-migrate @ 7884]
Christian Hammond <chipx86@chipx86.com>
parents:
7298
diff
changeset
|
907 |
7295 | 908 s = g_malloc(sizeof(struct _search)); |
909 s->gtkconv = gtkconv; | |
7929 | 910 |
911 gtkconv->dialogs.search = gtk_dialog_new_with_buttons(_("Find"), | |
912 GTK_WINDOW(gtkwin->window), GTK_DIALOG_DESTROY_WITH_PARENT, | |
913 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, | |
914 GTK_STOCK_FIND, GTK_RESPONSE_OK, NULL); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
915 gtk_dialog_set_default_response(GTK_DIALOG(gtkconv->dialogs.search), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
916 GTK_RESPONSE_OK); |
7929 | 917 g_signal_connect(G_OBJECT(gtkconv->dialogs.search), "response", |
918 G_CALLBACK(do_search_cb), s); | |
919 | |
920 gtk_container_set_border_width(GTK_CONTAINER(gtkconv->dialogs.search), 6); | |
921 gtk_window_set_resizable(GTK_WINDOW(gtkconv->dialogs.search), FALSE); | |
922 gtk_dialog_set_has_separator(GTK_DIALOG(gtkconv->dialogs.search), FALSE); | |
923 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
|
924 gtk_container_set_border_width( |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
925 GTK_CONTAINER(GTK_DIALOG(gtkconv->dialogs.search)->vbox), 6); |
7929 | 926 |
927 hbox = gtk_hbox_new(FALSE, 12); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
928 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(gtkconv->dialogs.search)->vbox), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
929 hbox); |
7929 | 930 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); |
931 | |
932 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
933 gtk_dialog_set_response_sensitive(GTK_DIALOG(gtkconv->dialogs.search), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
934 GTK_RESPONSE_OK, FALSE); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
935 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
936 label = gtk_label_new(NULL); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
937 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Search for:")); |
7929 | 938 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
939 | |
940 s->entry = gtk_entry_new(); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
941 gtk_entry_set_activates_default(GTK_ENTRY(s->entry), TRUE); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
942 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(s->entry)); |
7929 | 943 g_signal_connect(G_OBJECT(s->entry), "changed", |
944 G_CALLBACK(gaim_gtk_set_sensitive_if_input), | |
945 gtkconv->dialogs.search); | |
946 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
|
947 |
7295 | 948 gtk_widget_show_all(gtkconv->dialogs.search); |
7929 | 949 gtk_widget_grab_focus(s->entry); |
7295 | 950 } |
951 | |
5908
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 menu_add_pounce_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
954 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
955 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
956 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
957 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
958 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
959 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
960 gaim_gtkpounce_dialog_show(gaim_conversation_get_account(conv), |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
961 gaim_conversation_get_name(conv), NULL); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
962 } |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
963 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
964 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
965 menu_insert_link_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
966 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
967 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
968 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
969 GaimGtkConversation *gtkconv; |
8756 | 970 GtkIMHtmlToolbar *toolbar; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
971 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
972 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
973 gtkconv = GAIM_GTK_CONVERSATION(conv); |
8756 | 974 toolbar = GTK_IMHTMLTOOLBAR(gtkconv->toolbar); |
975 | |
976 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->link), | |
977 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->link))); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
978 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
979 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
980 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
981 menu_insert_image_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
982 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
983 GaimConvWindow *win = (GaimConvWindow *)data; |
8756 | 984 GaimConversation *conv; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
985 GaimGtkConversation *gtkconv; |
8756 | 986 GtkIMHtmlToolbar *toolbar; |
987 | |
988 conv = gaim_conv_window_get_active_conversation(win); | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
989 gtkconv = GAIM_GTK_CONVERSATION(gaim_conv_window_get_active_conversation(win)); |
8756 | 990 toolbar = GTK_IMHTMLTOOLBAR(gtkconv->toolbar); |
991 | |
992 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->image), | |
993 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->image))); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
994 } |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
995 |
5908
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_alias_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
998 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
999 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1000 GaimConversation *conv; |
7879 | 1001 GaimAccount *account; |
1002 const char *name; | |
1003 | |
1004 conv = gaim_conv_window_get_active_conversation(win); | |
1005 account = gaim_conversation_get_account(conv); | |
1006 name = gaim_conversation_get_name(conv); | |
1007 | |
1008 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
1009 GaimBuddy *b; | |
1010 | |
1011 b = gaim_find_buddy(account, name); | |
1012 if (b != NULL) | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1013 alias_dialog_bud(b); |
7879 | 1014 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
1015 GaimChat *c; | |
1016 | |
1017 c = gaim_blist_find_chat(account, name); | |
1018 if (c != NULL) | |
1019 alias_dialog_blist_chat(c); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1020 } |
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 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1024 menu_get_info_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1025 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1026 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1027 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1028 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1029 conv = gaim_conv_window_get_active_conversation(win); |
5908
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 info_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1032 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1033 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1034 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1035 menu_invite_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1036 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1037 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1038 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1039 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1040 conv = gaim_conv_window_get_active_conversation(win); |
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 invite_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1043 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1044 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1045 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1046 menu_warn_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1047 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1048 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1049 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1050 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1051 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1052 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1053 warn_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1054 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1055 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1056 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1057 menu_block_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1058 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1059 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1060 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1061 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1062 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1063 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1064 block_cb(NULL, conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1065 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1066 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1067 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1068 menu_add_remove_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1069 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1070 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1071 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1072 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1073 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1074 |
7928 | 1075 add_remove_cb(NULL, conv); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1076 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1077 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1078 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1079 menu_close_conv_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1080 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1081 GaimConvWindow *win = (GaimConvWindow *)data; |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1082 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1083 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
|
1084 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1085 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1086 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1087 menu_logging_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1088 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1089 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1090 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1091 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1092 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1093 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1094 if (conv == NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1095 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1096 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1097 gaim_conversation_set_logging(conv, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1098 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1099 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1100 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1101 static void |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1102 menu_toolbar_cb(gpointer data, guint action, GtkWidget *widget) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1103 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1104 GaimConvWindow *win = (GaimConvWindow *)data; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1105 GaimConversation *conv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1106 GaimGtkConversation *gtkconv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1107 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1108 conv = gaim_conv_window_get_active_conversation(win); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1109 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1110 if (conv == NULL) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1111 return; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1112 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1113 gtkconv = GAIM_GTK_CONVERSATION(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1114 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1115 gtkconv->show_formatting_toolbar = |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1116 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1117 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1118 if (gtkconv->show_formatting_toolbar) |
8317 | 1119 gtk_widget_show(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1120 else |
8317 | 1121 gtk_widget_hide(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1122 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1123 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
1124 static void |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1125 menu_sounds_cb(gpointer data, guint action, GtkWidget *widget) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1126 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1127 GaimConvWindow *win = (GaimConvWindow *)data; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1128 GaimConversation *conv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1129 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1130 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1131 conv = gaim_conv_window_get_active_conversation(win); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1132 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1133 if (!conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1134 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1135 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1136 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1137 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1138 gtkconv->make_sound = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1139 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1140 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1141 |
7961 | 1142 static void |
9188 | 1143 menu_timestamps_cb(gpointer data, guint action, GtkWidget *widget) |
1144 { | |
1145 GaimConvWindow *win = (GaimConvWindow *)data; | |
1146 GaimConversation *conv; | |
1147 GaimGtkConversation *gtkconv; | |
1148 | |
1149 conv = gaim_conv_window_get_active_conversation(win); | |
1150 | |
1151 if (!conv) | |
1152 return; | |
1153 | |
1154 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1155 | |
1156 gtkconv->show_timestamps = | |
1157 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); | |
1158 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
1159 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))); | |
1160 } | |
1161 | |
1162 static void | |
7961 | 1163 chat_do_im(GaimConversation *conv, const char *who) |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1164 { |
7961 | 1165 GaimPluginProtocolInfo *prpl_info = NULL; |
1166 char *real_who; | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1167 GaimConversation *conv2; |
7961 | 1168 GaimAccount *account; |
1169 | |
1170 account = gaim_conversation_get_account(conv); | |
1171 | |
1172 if(account && account->gc) | |
1173 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl); | |
1174 | |
1175 if(prpl_info && prpl_info->get_cb_real_name) | |
1176 real_who = prpl_info->get_cb_real_name(account->gc, | |
1177 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); | |
1178 else | |
1179 real_who = g_strdup(who); | |
1180 | |
1181 if(!real_who) | |
1182 return; | |
1183 | |
1184 conv2 = gaim_find_conversation_with_account(real_who, account); | |
1185 | |
1186 if (conv2 != NULL) | |
1187 gaim_conv_window_show(gaim_conversation_get_window(conv2)); | |
1188 else | |
1189 conv2 = gaim_conversation_new(GAIM_CONV_IM, account, real_who); | |
1190 | |
1191 g_free(real_who); | |
1192 } | |
1193 | |
1194 | |
1195 static void | |
1196 chat_im_button_cb(GtkWidget *widget, GaimConversation *conv) | |
1197 { | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1198 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1199 GaimGtkChatPane *gtkchat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1200 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1201 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1202 GtkTreeSelection *sel; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1203 const char *name; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1204 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1205 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1206 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1207 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1208 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1209 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1210 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1211 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1212 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
|
1213 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1214 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1215 |
7961 | 1216 chat_do_im(conv, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1217 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1218 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1219 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1220 ignore_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1221 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1222 GaimGtkConversation *gtkconv; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1223 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1224 GaimConvChat *chat; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1225 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1226 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1227 GtkTreeSelection *sel; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1228 const char *name; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1229 int pos; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1230 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1231 chat = GAIM_CONV_CHAT(conv); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1232 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1233 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1234 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1235 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1236 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1237 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1238 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1239 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
|
1240 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1241 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1242 else |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1243 return; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1244 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1245 pos = g_list_index(gaim_conv_chat_get_users(chat), name); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1246 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1247 if (gaim_conv_chat_is_user_ignored(chat, name)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1248 gaim_conv_chat_unignore(chat, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1249 else |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1250 gaim_conv_chat_ignore(chat, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1251 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1252 add_chat_buddy_common(conv, name, pos); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1253 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1254 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1255 static void |
7398 | 1256 menu_chat_im_cb(GtkWidget *w, GaimConversation *conv) |
1257 { | |
1258 const char *who = g_object_get_data(G_OBJECT(w), "user_data"); | |
1259 | |
1260 chat_do_im(conv, who); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1261 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1262 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1263 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1264 menu_chat_info_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1265 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1266 char *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1267 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1268 who = g_object_get_data(G_OBJECT(w), "user_data"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1269 |
7975 | 1270 chat_do_info(conv, who); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1271 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1272 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1273 static void |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1274 menu_chat_get_away_cb(GtkWidget *w, GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1275 { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1276 GaimPluginProtocolInfo *prpl_info = NULL; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1277 GaimConnection *gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1278 char *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1279 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1280 gc = gaim_conversation_get_gc(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1281 who = g_object_get_data(G_OBJECT(w), "user_data"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1282 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1283 if (gc != NULL) { |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1284 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1285 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1286 /* |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1287 * 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
|
1288 */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1289 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1290 if (prpl_info->get_cb_away != NULL) |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1291 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1292 prpl_info->get_cb_away(gc, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1293 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1294 } |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1295 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1296 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1297 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1298 static void |
7928 | 1299 menu_chat_add_remove_cb(GtkWidget *w, GaimConversation *conv) |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1300 { |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1301 GaimAccount *account; |
6695 | 1302 GaimBuddy *b; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1303 char *name; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1304 |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1305 account = gaim_conversation_get_account(conv); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1306 name = g_object_get_data(G_OBJECT(w), "user_data"); |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1307 b = gaim_find_buddy(account, name); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1308 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1309 if (b != NULL) |
5975 | 1310 show_confirm_del(b); |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1311 else if (account != NULL && gaim_account_is_connected(account)) |
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
1312 gaim_blist_request_add_buddy(account, name, NULL, NULL); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1313 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1314 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1315 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1316 |
8143 | 1317 static GtkWidget * |
1318 create_chat_menu(GaimConversation *conv, gchar *who, | |
1319 GaimPluginProtocolInfo *prpl_info, GaimConnection *gc) | |
1320 { | |
1321 static GtkWidget *menu = NULL; | |
1322 GtkWidget *button; | |
1323 | |
1324 /* | |
1325 * If a menu already exists, destroy it before creating a new one, | |
1326 * thus freeing-up the memory it occupied. | |
1327 */ | |
1328 if (menu) | |
1329 gtk_widget_destroy(menu); | |
1330 | |
1331 menu = gtk_menu_new(); | |
1332 | |
1333 button = gtk_menu_item_new_with_label(_("IM")); | |
1334 g_signal_connect(G_OBJECT(button), "activate", | |
1335 G_CALLBACK(menu_chat_im_cb), conv); | |
1336 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1337 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1338 gtk_widget_show(button); | |
1339 | |
1340 if (gaim_conv_chat_is_user_ignored(GAIM_CONV_CHAT(conv), who)) | |
1341 button = gtk_menu_item_new_with_label(_("Un-Ignore")); | |
1342 else | |
1343 button = gtk_menu_item_new_with_label(_("Ignore")); | |
1344 | |
1345 g_signal_connect(G_OBJECT(button), "activate", | |
1346 G_CALLBACK(ignore_cb), conv); | |
1347 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1348 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1349 gtk_widget_show(button); | |
1350 | |
8170 | 1351 if (gc && (prpl_info->get_info || prpl_info->get_cb_info)) { |
8143 | 1352 button = gtk_menu_item_new_with_label(_("Info")); |
1353 g_signal_connect(G_OBJECT(button), "activate", | |
1354 G_CALLBACK(menu_chat_info_cb), conv); | |
1355 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1356 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1357 gtk_widget_show(button); | |
1358 } | |
1359 | |
1360 if (gc && prpl_info->get_cb_away) { | |
1361 button = gtk_menu_item_new_with_label(_("Get Away Msg")); | |
1362 g_signal_connect(G_OBJECT(button), "activate", | |
1363 G_CALLBACK(menu_chat_get_away_cb), conv); | |
1364 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1365 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1366 gtk_widget_show(button); | |
1367 } | |
1368 | |
8170 | 1369 /* XXX: jabber can only add buddies from here in certain circumstances */ |
8143 | 1370 /* Added by Jonas <jonas@birme.se> */ |
1371 if (gc) { | |
1372 if (gaim_find_buddy(gc->account, who)) | |
1373 button = gtk_menu_item_new_with_label(_("Remove")); | |
1374 else | |
1375 button = gtk_menu_item_new_with_label(_("Add")); | |
1376 | |
1377 g_signal_connect(G_OBJECT(button), "activate", | |
1378 G_CALLBACK(menu_chat_add_remove_cb), conv); | |
1379 | |
1380 g_object_set_data(G_OBJECT(button), "user_data", who); | |
1381 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
1382 gtk_widget_show(button); | |
1383 } | |
1384 /* End Jonas */ | |
1385 | |
1386 return menu; | |
1387 } | |
1388 | |
1389 | |
1390 static gint | |
1391 gtkconv_chat_popup_menu_cb(GtkWidget *widget, GaimConversation *conv) | |
1392 { | |
1393 GaimGtkConversation *gtkconv; | |
1394 GaimPluginProtocolInfo *prpl_info = NULL; | |
1395 GaimGtkChatPane *gtkchat; | |
1396 GaimConnection *gc; | |
1397 GaimAccount *account; | |
1398 GtkTreeSelection *sel; | |
1399 GtkTreeIter iter; | |
1400 GtkTreeModel *model; | |
1401 GtkWidget *menu; | |
1402 gchar *who; | |
1403 | |
1404 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1405 gtkchat = gtkconv->u.chat; | |
1406 account = gaim_conversation_get_account(conv); | |
1407 gc = account->gc; | |
1408 | |
1409 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | |
1410 | |
1411 if (gc != NULL) | |
1412 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | |
1413 | |
1414 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); | |
1415 if(!gtk_tree_selection_get_selected(sel, NULL, &iter)) | |
1416 return FALSE; | |
1417 | |
1418 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &who, -1); | |
1419 menu = create_chat_menu (conv, who, prpl_info, gc); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1420 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1421 gaim_gtk_treeview_popup_menu_position_func, widget, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1422 0, GDK_CURRENT_TIME); |
8143 | 1423 |
1424 return TRUE; | |
1425 } | |
1426 | |
1427 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1428 static gint |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1429 right_click_chat_cb(GtkWidget *widget, GdkEventButton *event, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1430 GaimConversation *conv) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1431 { |
8143 | 1432 GaimGtkConversation *gtkconv; |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1433 GaimPluginProtocolInfo *prpl_info = NULL; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1434 GaimGtkChatPane *gtkchat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1435 GaimConnection *gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1436 GaimAccount *account; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1437 GtkTreePath *path; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1438 GtkTreeIter iter; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1439 GtkTreeModel *model; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1440 GtkTreeViewColumn *column; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1441 gchar *who; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1442 int x, y; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1443 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1444 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1445 gtkchat = gtkconv->u.chat; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1446 account = gaim_conversation_get_account(conv); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1447 gc = account->gc; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1448 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1449 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1450 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1451 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
|
1452 event->x, event->y, &path, &column, &x, &y); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1453 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1454 if (path == NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1455 return FALSE; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1456 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1457 if (gc != NULL) |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1458 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1459 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1460 gtk_tree_selection_select_path(GTK_TREE_SELECTION( |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1461 gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list))), path); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1462 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1463 gtk_tree_model_get_iter(GTK_TREE_MODEL(model), &iter, path); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1464 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
|
1465 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1466 if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) { |
7398 | 1467 chat_do_im(conv, who); |
1468 } else if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { | |
8143 | 1469 GtkWidget *menu = create_chat_menu (conv, who, prpl_info, gc); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1470 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1471 event->button, event->time); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1472 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1473 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1474 return TRUE; |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1475 } |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
1476 |
8133 | 1477 static void |
1478 move_to_next_unread_tab(GaimConversation *conv) | |
1479 { | |
1480 GaimConversation *next_conv = NULL; | |
1481 GaimConvWindow *win; | |
1482 GList *l; | |
1483 int index, i; | |
1484 | |
1485 win = gaim_conversation_get_window(conv); | |
1486 index = gaim_conversation_get_index(conv); | |
1487 | |
1488 /* First check the tabs after this position. */ | |
1489 for (l = g_list_nth(gaim_conv_window_get_conversations(win), index); | |
1490 l != NULL; | |
1491 l = l->next) { | |
1492 | |
1493 next_conv = (GaimConversation *)l->data; | |
1494 | |
1495 if (gaim_conversation_get_unseen(next_conv) > 0) | |
1496 break; | |
1497 | |
1498 next_conv = NULL; | |
1499 } | |
1500 | |
1501 if (next_conv == NULL) { | |
1502 | |
1503 /* Now check before this position. */ | |
1504 for (l = gaim_conv_window_get_conversations(win), i = 0; | |
1505 l != NULL && i < index; | |
1506 l = l->next) { | |
1507 | |
1508 next_conv = (GaimConversation *)l->data; | |
1509 | |
1510 if (gaim_conversation_get_unseen(next_conv) > 0) | |
1511 break; | |
1512 | |
1513 next_conv = NULL; | |
1514 } | |
1515 | |
1516 if (next_conv == NULL) { | |
1517 /* Okay, just grab the next conversation tab. */ | |
1518 if (index == gaim_conv_window_get_conversation_count(win) - 1) | |
1519 next_conv = gaim_conv_window_get_conversation_at(win, 0); | |
1520 else | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1521 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1522 next_conv = gaim_conv_window_get_conversation_at(win, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1523 index + 1); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1524 } |
8133 | 1525 } |
1526 } | |
1527 | |
1528 if (next_conv != NULL && next_conv != conv) { | |
1529 gaim_conv_window_switch_conversation(win, | |
1530 gaim_conversation_get_index(next_conv)); | |
1531 } | |
1532 } | |
1533 | |
4359 | 1534 static gboolean |
8105 | 1535 entry_key_press_cb(GtkWidget *entry, GdkEventKey *event, gpointer data) |
4359 | 1536 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1537 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1538 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1539 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1540 GaimGtkWindow *gtkwin; |
8105 | 1541 int numconvs; |
1542 int curconv; | |
1543 | |
1544 conv = (GaimConversation *)data; | |
1545 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1546 win = gaim_conversation_get_window(conv); | |
1547 gtkwin = GAIM_GTK_WINDOW(win); | |
1548 numconvs = gaim_conv_window_get_conversation_count(win); | |
1549 curconv = gaim_conversation_get_index(conv); | |
1550 | |
1551 /* If CTRL was held down... */ | |
1552 if (event->state & GDK_CONTROL_MASK) { | |
4359 | 1553 switch (event->keyval) { |
8105 | 1554 case GDK_Return: |
1555 case GDK_KP_Enter: | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1556 if (gaim_prefs_get_bool( |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1557 "/gaim/gtk/conversations/ctrl_enter_sends")) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1558 { |
8105 | 1559 send_cb(NULL, conv); |
1560 | |
1561 return TRUE; | |
1562 } | |
1563 break; | |
1564 | |
4359 | 1565 case GDK_Up: |
1566 if (!conv->send_history) | |
1567 break; | |
1568 | |
1569 if (!conv->send_history->prev) { | |
1570 GtkTextIter start, end; | |
1571 | |
1572 if (conv->send_history->data) | |
1573 g_free(conv->send_history->data); | |
1574 | |
1575 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, | |
1576 &start); | |
1577 gtk_text_buffer_get_end_iter(gtkconv->entry_buffer, &end); | |
1578 | |
1579 conv->send_history->data = | |
8506 | 1580 gtk_imhtml_get_markup(GTK_IMHTML(gtkconv->entry)); |
4359 | 1581 } |
8677 | 1582 |
4359 | 1583 if (conv->send_history->next && |
1584 conv->send_history->next->data) { | |
8677 | 1585 GtkTextIter iter; |
1586 GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); | |
4359 | 1587 |
1588 conv->send_history = conv->send_history->next; | |
8061 | 1589 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1590 gtk_imhtml_append_text_with_images( |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1591 GTK_IMHTML(gtkconv->entry), conv->send_history->data, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1592 0, NULL); |
8677 | 1593 /* this is mainly just a hack so the formatting at the |
1594 * cursor gets picked up. */ | |
1595 gtk_text_buffer_get_end_iter(buffer, &iter); | |
1596 gtk_text_buffer_move_mark_by_name(buffer, "insert", &iter); | |
4359 | 1597 } |
1598 | |
8105 | 1599 return TRUE; |
4359 | 1600 break; |
1601 | |
1602 case GDK_Down: | |
1603 if (!conv->send_history) | |
1604 break; | |
1605 | |
8105 | 1606 if (conv->send_history->prev && |
1607 conv->send_history->prev->data) { | |
8677 | 1608 GtkTextIter iter; |
1609 GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); | |
8105 | 1610 |
4359 | 1611 conv->send_history = conv->send_history->prev; |
8105 | 1612 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1613 gtk_imhtml_append_text_with_images( |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1614 GTK_IMHTML(gtkconv->entry), conv->send_history->data, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1615 0, NULL); |
8677 | 1616 /* this is mainly just a hack so the formatting at the |
1617 * cursor gets picked up. */ | |
1618 gtk_text_buffer_get_end_iter(buffer, &iter); | |
1619 gtk_text_buffer_move_mark_by_name(buffer, "insert", &iter); | |
4359 | 1620 } |
1621 | |
8105 | 1622 return TRUE; |
4359 | 1623 break; |
8105 | 1624 |
8108 | 1625 case GDK_Page_Down: |
8143 | 1626 case ']': |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1627 gaim_conv_window_switch_conversation(win, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1628 (curconv + 1) % numconvs); |
8105 | 1629 |
1630 return TRUE; | |
1631 break; | |
1632 | |
8108 | 1633 case GDK_Page_Up: |
8143 | 1634 case '[': |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1635 gaim_conv_window_switch_conversation(win, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1636 (curconv + numconvs - 1) % numconvs); |
8133 | 1637 |
1638 return TRUE; | |
1639 break; | |
1640 | |
8108 | 1641 case GDK_Tab: |
8133 | 1642 move_to_next_unread_tab(conv); |
8108 | 1643 |
1644 return TRUE; | |
1645 break; | |
1646 | |
1647 case 'z': | |
1648 gtk_window_iconify(GTK_WINDOW(gtkwin->window)); | |
8105 | 1649 |
1650 return TRUE; | |
1651 break; | |
1652 | |
1653 } /* End of switch */ | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1654 } |
8758 | 1655 |
8105 | 1656 /* If ALT (or whatever) was held down... */ |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1657 else if (event->state & GDK_MOD1_MASK) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1658 { |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8730
diff
changeset
|
1659 /* XXX - Make sure the conv exists before switching to it */ |
8105 | 1660 if (event->keyval > '0' && event->keyval <= '9') { |
1661 int switchto = event->keyval - '1'; | |
1662 if (switchto < numconvs) | |
1663 gaim_conv_window_switch_conversation(win, switchto); | |
4359 | 1664 |
1665 return TRUE; | |
1666 } | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1667 } |
8758 | 1668 |
8105 | 1669 /* If neither CTRL nor ALT were held down... */ |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1670 else |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1671 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1672 switch (event->keyval) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1673 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1674 case GDK_Return: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1675 case GDK_KP_Enter: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1676 if (!(event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK)) && |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1677 gaim_prefs_get_bool("/gaim/gtk/conversations/enter_sends")) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1678 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1679 send_cb(NULL, conv); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1680 return TRUE; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1681 } |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1682 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1683 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1684 case GDK_Tab: |
8941 | 1685 if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1686 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1687 tab_complete(conv); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1688 return TRUE; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1689 } |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1690 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1691 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1692 case GDK_Page_Up: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1693 gtk_imhtml_page_up(GTK_IMHTML(gtkconv->imhtml)); |
8105 | 1694 return TRUE; |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1695 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1696 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1697 case GDK_Page_Down: |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1698 gtk_imhtml_page_down(GTK_IMHTML(gtkconv->imhtml)); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1699 return TRUE; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1700 break; |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1701 |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1702 } |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
1703 } |
4359 | 1704 |
1705 return FALSE; | |
1706 } | |
1707 | |
1708 /* | |
1709 * NOTE: | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
1710 * 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
|
1711 * further. I have no idea *why* we need this, but we do ... It |
4359 | 1712 * 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
|
1713 * going all the way down to the notebook. I suspect a bug in |
4359 | 1714 * GtkTextView, but I'm not ready to point any fingers yet. |
1715 */ | |
1716 static gboolean | |
1717 entry_stop_rclick_cb(GtkWidget *widget, GdkEventButton *event, gpointer data) | |
1718 { | |
1719 if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { | |
1720 /* Right single click */ | |
1721 g_signal_stop_emission_by_name(G_OBJECT(widget), "button_press_event"); | |
1722 | |
1723 return TRUE; | |
1724 } | |
1725 | |
1726 return FALSE; | |
1727 } | |
1728 | |
8173 | 1729 /* |
1730 * If someone tries to type into the conversation backlog of a | |
1731 * conversation window then we yank focus from the conversation backlog | |
1732 * and give it to the text entry box so that people can type | |
1733 * all the live long day and it will get entered into the entry box. | |
1734 */ | |
6057 | 1735 static gboolean |
8105 | 1736 refocus_entry_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) |
6057 | 1737 { |
1738 GaimGtkConversation *gtkconv = data; | |
1739 | |
8237 | 1740 /* If we have a valid key for the conversation display, then exit */ |
8224 | 1741 if ((event->state & GDK_CONTROL_MASK) || |
8237 | 1742 (event->keyval == GDK_F10) || |
1743 (event->keyval == GDK_Shift_L) || | |
1744 (event->keyval == GDK_Shift_R) || | |
1745 (event->keyval == GDK_Escape) || | |
8177 | 1746 (event->keyval == GDK_Up) || |
1747 (event->keyval == GDK_Down) || | |
1748 (event->keyval == GDK_Left) || | |
8191 | 1749 (event->keyval == GDK_Right) || |
1750 (event->keyval == GDK_Home) || | |
9297 | 1751 (event->keyval == GDK_End) || |
1752 (event->keyval == GDK_Tab) || | |
1753 (event->keyval == GDK_ISO_Left_Tab)) | |
8177 | 1754 return FALSE; |
1755 | |
1756 if (event->type == GDK_KEY_RELEASE) | |
1757 gtk_widget_grab_focus(gtkconv->entry); | |
1758 | |
1759 gtk_widget_event(gtkconv->entry, (GdkEvent *)event); | |
1760 | |
1761 return TRUE; | |
6057 | 1762 } |
1763 | |
4359 | 1764 static void |
4673 | 1765 menu_conv_sel_send_cb(GObject *m, gpointer data) |
4359 | 1766 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1767 GaimConvWindow *win = g_object_get_data(m, "user_data"); |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
1768 GaimAccount *account = g_object_get_data(m, "gaim_account"); |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1769 GaimConversation *conv; |
8456 | 1770 GaimGtkConversation *gtkconv; |
1771 GaimPlugin *protocol; | |
4359 | 1772 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1773 conv = gaim_conv_window_get_active_conversation(win); |
4359 | 1774 |
4491 | 1775 gaim_conversation_set_account(conv, account); |
8456 | 1776 |
1777 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
1778 protocol = gaim_find_prpl(conv->account->protocol_id); | |
1779 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), | |
1780 protocol->info->name); | |
4359 | 1781 } |
1782 | |
1783 static void | |
1784 insert_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *position, | |
1785 gchar *new_text, gint new_text_length, gpointer user_data) | |
1786 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1787 GaimConversation *conv = (GaimConversation *)user_data; |
4359 | 1788 |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1789 g_return_if_fail(conv != NULL); |
4359 | 1790 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1791 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) |
4359 | 1792 return; |
1793 | |
1794 got_typing_keypress(conv, (gtk_text_iter_is_start(position) && | |
1795 gtk_text_iter_is_end(position))); | |
1796 } | |
1797 | |
1798 static void | |
1799 delete_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *start_pos, | |
1800 GtkTextIter *end_pos, gpointer user_data) | |
1801 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1802 GaimConversation *conv = (GaimConversation *)user_data; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1803 GaimConvIm *im; |
4359 | 1804 |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1805 g_return_if_fail(conv != NULL); |
4359 | 1806 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
1807 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) |
4359 | 1808 return; |
1809 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1810 im = GAIM_CONV_IM(conv); |
4359 | 1811 |
1812 if (gtk_text_iter_is_start(start_pos) && gtk_text_iter_is_end(end_pos)) { | |
1813 | |
1814 /* We deleted all the text, so turn off typing. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1815 if (gaim_conv_im_get_type_again_timeout(im)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1816 gaim_conv_im_stop_type_again_timeout(im); |
4359 | 1817 |
1818 serv_send_typing(gaim_conversation_get_gc(conv), | |
6695 | 1819 gaim_conversation_get_name(conv), |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
1820 GAIM_NOT_TYPING); |
4359 | 1821 } |
1822 else { | |
1823 /* We're deleting, but not all of it, so it counts as typing. */ | |
1824 got_typing_keypress(conv, FALSE); | |
1825 } | |
1826 } | |
1827 | |
1828 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1829 notebook_init_grab(GaimGtkWindow *gtkwin, GtkWidget *widget) |
4359 | 1830 { |
1831 static GdkCursor *cursor = NULL; | |
1832 | |
1833 gtkwin->in_drag = TRUE; | |
1834 | |
1835 if (gtkwin->drag_leave_signal) { | |
1836 g_signal_handler_disconnect(G_OBJECT(widget), | |
1837 gtkwin->drag_leave_signal); | |
1838 | |
1839 gtkwin->drag_leave_signal = 0; | |
1840 } | |
1841 | |
1842 if (cursor == NULL) | |
1843 cursor = gdk_cursor_new(GDK_FLEUR); | |
1844 | |
1845 /* Grab the pointer */ | |
1846 gtk_grab_add(gtkwin->notebook); | |
5114
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1847 #ifndef _WIN32 |
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1848 /* 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
|
1849 always be true after a button press. */ |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1850 if (!gdk_pointer_is_grabbed()) |
5114
e245e686f62f
[gaim-migrate @ 5477]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5106
diff
changeset
|
1851 #endif |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1852 gdk_pointer_grab(gtkwin->notebook->window, FALSE, |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1853 GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1854 NULL, cursor, GDK_CURRENT_TIME); |
4359 | 1855 } |
1856 | |
1857 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1858 notebook_motion_cb(GtkWidget *widget, GdkEventButton *e, GaimConvWindow *win) |
4359 | 1859 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1860 GaimGtkWindow *gtkwin; |
4359 | 1861 |
1862 gtkwin = GAIM_GTK_WINDOW(win); | |
1863 | |
1864 /* | |
1865 * Make sure the user moved the mouse far enough for the | |
1866 * drag to be initiated. | |
1867 */ | |
1868 if (gtkwin->in_predrag) { | |
1869 if (e->x_root < gtkwin->drag_min_x || | |
1870 e->x_root >= gtkwin->drag_max_x || | |
1871 e->y_root < gtkwin->drag_min_y || | |
1872 e->y_root >= gtkwin->drag_max_y) { | |
1873 | |
1874 gtkwin->in_predrag = FALSE; | |
1875 notebook_init_grab(gtkwin, widget); | |
1876 } | |
1877 } | |
1878 else { /* Otherwise, draw the arrows. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1879 GaimConvWindow *dest_win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1880 GaimGtkWindow *dest_gtkwin; |
4359 | 1881 GtkNotebook *dest_notebook; |
1882 GtkWidget *tab, *last_vis_tab = NULL; | |
1883 gint nb_x, nb_y, page_num, i, last_vis_tab_loc = -1; | |
1884 gint arrow1_x, arrow1_y, arrow2_x, arrow2_y; | |
1885 gboolean horiz_tabs = FALSE, tab_found = FALSE; | |
1886 GList *l; | |
1887 | |
1888 /* Get the window that the cursor is over. */ | |
1889 dest_win = gaim_gtkwin_get_at_xy(e->x_root, e->y_root); | |
1890 | |
1891 if (dest_win == NULL) { | |
1892 dnd_hints_hide_all(); | |
1893 | |
1894 return TRUE; | |
1895 } | |
1896 | |
1897 dest_gtkwin = GAIM_GTK_WINDOW(dest_win); | |
1898 | |
1899 dest_notebook = GTK_NOTEBOOK(dest_gtkwin->notebook); | |
1900 | |
1901 gdk_window_get_origin(GTK_WIDGET(dest_notebook)->window, &nb_x, &nb_y); | |
1902 | |
1903 arrow1_x = arrow2_x = nb_x; | |
1904 arrow1_y = arrow2_y = nb_y; | |
1905 | |
1906 page_num = gaim_gtkconv_get_dest_tab_at_xy(dest_win, | |
1907 e->x_root, e->y_root); | |
1908 | |
1909 if (gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_TOP || | |
1910 gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_BOTTOM) { | |
1911 | |
1912 horiz_tabs = TRUE; | |
1913 } | |
1914 | |
1915 /* Find out where to put the arrows. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1916 for (l = gaim_conv_window_get_conversations(dest_win), i = 0; |
4359 | 1917 l != NULL; |
1918 l = l->next, i++) { | |
1919 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1920 GaimConversation *conv = l->data; |
4359 | 1921 |
1922 tab = GAIM_GTK_CONVERSATION(conv)->tabby; | |
1923 | |
1924 /* | |
1925 * If this is the correct tab, record the positions | |
1926 * for the arrows. | |
1927 */ | |
1928 if (i == page_num) { | |
1929 if (horiz_tabs) { | |
1930 arrow1_x = arrow2_x = nb_x + tab->allocation.x; | |
1931 arrow1_y = nb_y + tab->allocation.y; | |
1932 arrow2_y = nb_y + tab->allocation.y + | |
1933 tab->allocation.height; | |
1934 } | |
1935 else { | |
1936 arrow1_x = nb_x + tab->allocation.x; | |
1937 arrow2_x = nb_x + tab->allocation.x + | |
1938 tab->allocation.width; | |
1939 arrow1_y = arrow2_y = nb_y + tab->allocation.y; | |
1940 } | |
1941 | |
1942 tab_found = TRUE; | |
1943 break; | |
1944 } | |
1945 else { /* Keep track of the right-most tab that we see. */ | |
1946 if (horiz_tabs && tab->allocation.x > last_vis_tab_loc) { | |
1947 last_vis_tab = tab; | |
1948 last_vis_tab_loc = tab->allocation.x; | |
1949 } | |
1950 else if (!horiz_tabs && tab->allocation.y > last_vis_tab_loc) { | |
1951 last_vis_tab = tab; | |
1952 last_vis_tab_loc = tab->allocation.y; | |
1953 } | |
1954 } | |
1955 } | |
1956 | |
1957 /* | |
1958 * If we didn't find the tab, then we'll just place the | |
1959 * arrows to the right/bottom of the last visible tab. | |
1960 */ | |
1961 if (!tab_found && last_vis_tab) { | |
1962 if (horiz_tabs) { | |
1963 arrow1_x = arrow2_x = nb_x + last_vis_tab->allocation.x + | |
1964 last_vis_tab->allocation.width; | |
1965 arrow1_y = nb_y + last_vis_tab->allocation.y; | |
1966 arrow2_y = nb_y + last_vis_tab->allocation.y + | |
1967 last_vis_tab->allocation.height; | |
1968 } | |
1969 else { | |
1970 arrow1_x = nb_x + last_vis_tab->allocation.x; | |
1971 arrow2_x = nb_x + last_vis_tab->allocation.x + | |
1972 last_vis_tab->allocation.width; | |
1973 arrow1_y = arrow2_y = nb_y + last_vis_tab->allocation.y + | |
1974 last_vis_tab->allocation.height; | |
1975 } | |
1976 } | |
1977 | |
1978 if (horiz_tabs) { | |
1979 dnd_hints_show(HINT_ARROW_DOWN, arrow1_x, arrow1_y); | |
1980 dnd_hints_show(HINT_ARROW_UP, arrow2_x, arrow2_y); | |
1981 } | |
1982 else { | |
1983 dnd_hints_show(HINT_ARROW_RIGHT, arrow1_x, arrow1_y); | |
1984 dnd_hints_show(HINT_ARROW_LEFT, arrow2_x, arrow2_y); | |
1985 } | |
1986 } | |
1987 | |
1988 return TRUE; | |
1989 } | |
1990 | |
1991 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
1992 notebook_leave_cb(GtkWidget *widget, GdkEventCrossing *e, GaimConvWindow *win) |
4359 | 1993 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
1994 GaimGtkWindow *gtkwin; |
4359 | 1995 |
1996 gtkwin = GAIM_GTK_WINDOW(win); | |
1997 | |
1998 if (gtkwin->in_drag) | |
1999 return FALSE; | |
2000 | |
2001 if (e->x_root < gtkwin->drag_min_x || | |
2002 e->x_root >= gtkwin->drag_max_x || | |
2003 e->y_root < gtkwin->drag_min_y || | |
2004 e->y_root >= gtkwin->drag_max_y) { | |
2005 | |
2006 gtkwin->in_predrag = FALSE; | |
2007 notebook_init_grab(gtkwin, widget); | |
2008 } | |
2009 | |
2010 return TRUE; | |
2011 } | |
2012 | |
2013 /* | |
2014 * THANK YOU GALEON! | |
2015 */ | |
2016 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2017 notebook_press_cb(GtkWidget *widget, GdkEventButton *e, GaimConvWindow *win) |
4359 | 2018 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2019 GaimGtkWindow *gtkwin; |
4359 | 2020 gint nb_x, nb_y, x_rel, y_rel; |
2021 GList *l; | |
2022 int tab_clicked; | |
2023 | |
2024 if (e->button != 1 || e->type != GDK_BUTTON_PRESS) | |
2025 return FALSE; | |
2026 | |
2027 gtkwin = GAIM_GTK_WINDOW(win); | |
2028 | |
2029 if (gtkwin->in_drag) { | |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
2030 gaim_debug(GAIM_DEBUG_WARNING, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
2031 "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
|
2032 return TRUE; |
4359 | 2033 } |
2034 | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
2035 /* |
4359 | 2036 * Make sure a tab was actually clicked. The arrow buttons |
2037 * mess things up. | |
2038 */ | |
2039 tab_clicked = gaim_gtkconv_get_tab_at_xy(win, e->x_root, e->y_root); | |
2040 | |
2041 if (tab_clicked == -1) | |
2042 return FALSE; | |
2043 | |
2044 /* | |
2045 * Get the relative position of the press event, with regards to | |
2046 * the position of the notebook. | |
2047 */ | |
2048 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
2049 | |
2050 x_rel = e->x_root - nb_x; | |
2051 y_rel = e->y_root - nb_y; | |
2052 | |
2053 /* Reset the min/max x/y */ | |
2054 gtkwin->drag_min_x = 0; | |
2055 gtkwin->drag_min_y = 0; | |
2056 gtkwin->drag_max_x = 0; | |
2057 gtkwin->drag_max_y = 0; | |
2058 | |
2059 /* Find out which tab was dragged. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2060 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
|
2061 GaimConversation *conv = l->data; |
4359 | 2062 GtkWidget *tab = GAIM_GTK_CONVERSATION(conv)->tabby; |
2063 | |
2064 if (!GTK_WIDGET_VISIBLE(tab)) | |
2065 continue; | |
2066 | |
2067 if (tab->allocation.x > x_rel || tab->allocation.y > y_rel) | |
2068 break; | |
2069 | |
2070 /* Save the borders of the tab. */ | |
2071 gtkwin->drag_min_x = tab->allocation.x + nb_x; | |
2072 gtkwin->drag_min_y = tab->allocation.y + nb_y; | |
2073 gtkwin->drag_max_x = tab->allocation.width + gtkwin->drag_min_x; | |
2074 gtkwin->drag_max_y = tab->allocation.height + gtkwin->drag_min_y; | |
2075 } | |
2076 | |
2077 /* Make sure the click occurred in the tab. */ | |
2078 if (e->x_root < gtkwin->drag_min_x || | |
2079 e->x_root >= gtkwin->drag_max_x || | |
2080 e->y_root < gtkwin->drag_min_y || | |
2081 e->y_root >= gtkwin->drag_max_y) { | |
2082 | |
2083 return FALSE; | |
2084 } | |
2085 | |
2086 gtkwin->in_predrag = TRUE; | |
2087 | |
2088 /* Connect the new motion signals. */ | |
2089 gtkwin->drag_motion_signal = | |
2090 g_signal_connect(G_OBJECT(widget), "motion_notify_event", | |
2091 G_CALLBACK(notebook_motion_cb), win); | |
2092 | |
2093 gtkwin->drag_leave_signal = | |
2094 g_signal_connect(G_OBJECT(widget), "leave_notify_event", | |
2095 G_CALLBACK(notebook_leave_cb), win); | |
2096 | |
2097 return FALSE; | |
2098 } | |
2099 | |
2100 static gboolean | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2101 notebook_release_cb(GtkWidget *widget, GdkEventButton *e, GaimConvWindow *win) |
4359 | 2102 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2103 GaimConvWindow *dest_win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2104 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2105 GaimGtkWindow *dest_gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2106 GaimConversation *conv; |
4359 | 2107 GtkNotebook *dest_notebook; |
2108 gint dest_page_num; | |
2109 | |
2110 /* | |
2111 * Don't check to make sure that the event's window matches the | |
2112 * widget's, because we may be getting an event passed on from the | |
2113 * close button. | |
2114 */ | |
2115 if (e->button != 1 && e->type != GDK_BUTTON_RELEASE) | |
2116 return FALSE; | |
2117 | |
2118 if (gdk_pointer_is_grabbed()) { | |
2119 gdk_pointer_ungrab(GDK_CURRENT_TIME); | |
2120 gtk_grab_remove(widget); | |
2121 } | |
2122 | |
2123 gtkwin = GAIM_GTK_WINDOW(win); | |
2124 | |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
2125 if (!gtkwin->in_predrag && !gtkwin->in_drag) |
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
2126 return FALSE; |
4359 | 2127 |
2128 /* Disconnect the motion signal. */ | |
2129 if (gtkwin->drag_motion_signal) { | |
2130 g_signal_handler_disconnect(G_OBJECT(widget), | |
2131 gtkwin->drag_motion_signal); | |
2132 | |
2133 gtkwin->drag_motion_signal = 0; | |
2134 } | |
2135 | |
2136 /* | |
2137 * If we're in a pre-drag, we'll also need to disconnect the leave | |
2138 * signal. | |
2139 */ | |
2140 if (gtkwin->in_predrag) { | |
2141 gtkwin->in_predrag = FALSE; | |
2142 | |
2143 if (gtkwin->drag_leave_signal) { | |
2144 g_signal_handler_disconnect(G_OBJECT(widget), | |
2145 gtkwin->drag_leave_signal); | |
2146 | |
2147 gtkwin->drag_leave_signal = 0; | |
2148 } | |
2149 } | |
2150 | |
2151 /* If we're not in drag... */ | |
2152 /* We're perfectly normal people! */ | |
4803
6f04901ef729
[gaim-migrate @ 5123]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
2153 if (!gtkwin->in_drag) |
4359 | 2154 return FALSE; |
2155 | |
2156 gtkwin->in_drag = FALSE; | |
2157 | |
2158 dnd_hints_hide_all(); | |
2159 | |
4369
7e1fb422e5fd
[gaim-migrate @ 4635]
Christian Hammond <chipx86@chipx86.com>
parents:
4368
diff
changeset
|
2160 dest_win = gaim_gtkwin_get_at_xy(e->x_root, e->y_root); |
4359 | 2161 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2162 conv = gaim_conv_window_get_active_conversation(win); |
4359 | 2163 |
2164 if (dest_win == NULL) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2165 if (gaim_conv_window_get_conversation_count(win) < 2) |
4359 | 2166 return FALSE; |
2167 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2168 if (gaim_conv_window_get_conversation_count(win) > 1) { |
4359 | 2169 /* Make a new window to stick this to. */ |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2170 GaimGtkConversation *gtkconv; |
4748
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2171 gint win_width, win_height; |
5121 | 2172 |
2173 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4359 | 2174 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2175 dest_win = gaim_conv_window_new(); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2176 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2177 gaim_conv_window_add_conversation(dest_win, |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2178 gaim_conv_window_remove_conversation(win, |
5139
d0182ae31ab8
[gaim-migrate @ 5503]
Christian Hammond <chipx86@chipx86.com>
parents:
5133
diff
changeset
|
2179 gaim_conversation_get_index(conv))); |
5121 | 2180 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2181 dest_gtkwin = GAIM_GTK_WINDOW(dest_win); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2182 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2183 gtk_window_get_size(GTK_WINDOW(dest_gtkwin->window), |
4748
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2184 &win_width, &win_height); |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2185 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2186 gtk_window_move(GTK_WINDOW(dest_gtkwin->window), |
4748
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2187 e->x_root - (win_width / 2), |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2188 e->y_root - (win_height / 2)); |
d3c09ddfd3aa
[gaim-migrate @ 5063]
Christian Hammond <chipx86@chipx86.com>
parents:
4736
diff
changeset
|
2189 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2190 gaim_conv_window_show(dest_win); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2191 } |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2192 } else { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2193 dest_gtkwin = GAIM_GTK_WINDOW(dest_win); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2194 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2195 /* Get the destination notebook. */ |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2196 dest_notebook = GTK_NOTEBOOK(gtkwin->notebook); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2197 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2198 /* Get the destination page number. */ |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2199 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
|
2200 e->x_root, e->y_root); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2201 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2202 if (win == dest_win) { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2203 gaim_conv_window_move_conversation(win, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2204 gaim_conversation_get_index(conv), dest_page_num); |
4359 | 2205 } |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2206 else { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2207 size_t pos; |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2208 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2209 gaim_conv_window_remove_conversation(win, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2210 gaim_conversation_get_index(conv)); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2211 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2212 pos = gaim_conv_window_add_conversation(dest_win, conv); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2213 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2214 if (pos != dest_page_num) |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2215 gaim_conv_window_move_conversation(dest_win, pos, dest_page_num); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2216 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2217 gaim_conv_window_switch_conversation(dest_win, dest_page_num); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2218 } |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2219 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2220 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry); |
4359 | 2221 } |
2222 | |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2223 gaim_signal_emit(gaim_gtk_conversations_get_handle(), "conversation-drag-ended", |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
2224 win, dest_win); |
4359 | 2225 |
2226 return TRUE; | |
2227 } | |
2228 | |
8189 | 2229 /************************************************************************** |
2230 * A bunch of buddy icon functions | |
2231 **************************************************************************/ | |
2232 static GdkPixbuf * | |
8755
d0364feabf96
[gaim-migrate @ 9510]
Christian Hammond <chipx86@chipx86.com>
parents:
8748
diff
changeset
|
2233 get_tab_icon(GaimConversation *conv, gboolean small_icon) |
7143 | 2234 { |
2235 GaimAccount *account = gaim_conversation_get_account(conv); | |
2236 const char *name = gaim_conversation_get_name(conv); | |
2237 GdkPixbuf *status = NULL; | |
2238 | |
2239 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
2240 GaimBuddy *b = gaim_find_buddy(account, name); | |
2241 if (b != NULL) { | |
2242 status = gaim_gtk_blist_get_status_icon((GaimBlistNode*)b, | |
8755
d0364feabf96
[gaim-migrate @ 9510]
Christian Hammond <chipx86@chipx86.com>
parents:
8748
diff
changeset
|
2243 (small_icon ? GAIM_STATUS_ICON_SMALL : GAIM_STATUS_ICON_LARGE)); |
7143 | 2244 } |
2245 } | |
2246 | |
2247 if (!status) { | |
2248 GdkPixbuf *pixbuf; | |
2249 pixbuf = create_prpl_icon(account); | |
2250 | |
8755
d0364feabf96
[gaim-migrate @ 9510]
Christian Hammond <chipx86@chipx86.com>
parents:
8748
diff
changeset
|
2251 if (small_icon && pixbuf != NULL) |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2252 { |
7143 | 2253 status = gdk_pixbuf_scale_simple(pixbuf, 15, 15, |
2254 GDK_INTERP_BILINEAR); | |
2255 g_object_unref(pixbuf); | |
2256 } | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2257 else |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2258 status = pixbuf; |
7143 | 2259 } |
2260 return status; | |
2261 } | |
2262 | |
8189 | 2263 static void |
2264 update_tab_icon(GaimConversation *conv) | |
2265 { | |
2266 GaimGtkConversation *gtkconv; | |
2267 GaimConvWindow *win = gaim_conversation_get_window(conv); | |
2268 GaimAccount *account; | |
2269 const char *name; | |
2270 GdkPixbuf *status = NULL; | |
2271 | |
2272 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2273 name = gaim_conversation_get_name(conv); | |
2274 account = gaim_conversation_get_account(conv); | |
2275 | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2276 status = get_tab_icon(conv, TRUE); |
8189 | 2277 |
2278 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->icon), status); | |
2279 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->menu_icon), status); | |
2280 | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2281 if (status != NULL) |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2282 g_object_unref(status); |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2283 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2284 if (gaim_conv_window_get_active_conversation(win) == conv && |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2285 gtkconv->u.im->anim == NULL) |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2286 { |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2287 status = get_tab_icon(conv, FALSE); |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2288 |
8189 | 2289 gtk_window_set_icon(GTK_WINDOW(GAIM_GTK_WINDOW(win)->window), status); |
2290 | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2291 if (status != NULL) |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2292 g_object_unref(status); |
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2293 } |
8189 | 2294 } |
2295 | |
9318 | 2296 static void |
2297 get_icon_scale_size(GdkPixbufAnimation *icon, GaimBuddyIconSpec *spec, int *width, int *height) | |
2298 { | |
2299 *width = gdk_pixbuf_animation_get_width(icon); | |
2300 *height = gdk_pixbuf_animation_get_height(icon); | |
2301 | |
2302 /* this should eventually get smarter about preserving the aspect | |
2303 * ratio when scaling, but gimmie a break, I just woke up */ | |
2304 if(spec && spec->scale_rules & GAIM_ICON_SCALE_DISPLAY) { | |
2305 if(*width < spec->min_width) | |
2306 *width = spec->min_width; | |
2307 else if(*width > spec->max_width) | |
2308 *width = spec->max_width; | |
2309 | |
2310 if(*height < spec->min_height) | |
2311 *height = spec->min_height; | |
9319 | 2312 else if(*height > spec->max_height) |
9318 | 2313 *height = spec->max_height; |
2314 } | |
2315 | |
2316 /* and now for some arbitrary sanity checks */ | |
2317 if(*width > 100) | |
2318 *width = 100; | |
2319 if(*height > 100) | |
2320 *height = 100; | |
2321 } | |
2322 | |
8189 | 2323 static gboolean |
2324 redraw_icon(gpointer data) | |
2325 { | |
2326 GaimConversation *conv = (GaimConversation *)data; | |
2327 GaimGtkConversation *gtkconv; | |
9318 | 2328 GaimAccount *account; |
2329 GaimPluginProtocolInfo *prpl_info = NULL; | |
8189 | 2330 |
2331 GdkPixbuf *buf; | |
2332 GdkPixbuf *scale; | |
2333 GdkPixmap *pm; | |
2334 GdkBitmap *bm; | |
2335 gint delay; | |
9318 | 2336 int scale_width, scale_height; |
8189 | 2337 |
2338 if (!g_list_find(gaim_get_ims(), conv)) { | |
2339 gaim_debug(GAIM_DEBUG_WARNING, "gtkconv", | |
2340 "Conversation not found in redraw_icon. I think this " | |
2341 "is a bug.\n"); | |
2342 return FALSE; | |
2343 } | |
2344 | |
2345 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
9318 | 2346 account = gaim_conversation_get_account(conv); |
2347 if(account && account->gc) | |
2348 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl); | |
8189 | 2349 |
2350 gdk_pixbuf_animation_iter_advance(gtkconv->u.im->iter, NULL); | |
2351 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); | |
2352 | |
9318 | 2353 get_icon_scale_size(gtkconv->u.im->anim, prpl_info ? &prpl_info->icon_spec : |
2354 NULL, &scale_width, &scale_height); | |
2355 | |
2356 /* this code is ugly, and scares me */ | |
8189 | 2357 scale = gdk_pixbuf_scale_simple(buf, |
9318 | 2358 MAX(gdk_pixbuf_get_width(buf) * scale_width / |
8189 | 2359 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), |
9318 | 2360 MAX(gdk_pixbuf_get_height(buf) * scale_height / |
8189 | 2361 gdk_pixbuf_animation_get_height(gtkconv->u.im->anim), 1), |
2362 GDK_INTERP_NEAREST); | |
2363 | |
2364 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); | |
2365 g_object_unref(G_OBJECT(scale)); | |
2366 gtk_image_set_from_pixmap(GTK_IMAGE(gtkconv->u.im->icon), pm, bm); | |
2367 g_object_unref(G_OBJECT(pm)); | |
2368 gtk_widget_queue_draw(gtkconv->u.im->icon); | |
2369 | |
2370 if (bm) | |
2371 g_object_unref(G_OBJECT(bm)); | |
2372 | |
9131 | 2373 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter); |
2374 if (delay <= 0) | |
2375 delay = 100; | |
2376 | |
2377 gtkconv->u.im->icon_timer = g_timeout_add(delay, redraw_icon, conv); | |
8189 | 2378 |
2379 return FALSE; | |
2380 } | |
2381 | |
2382 static void | |
2383 start_anim(GtkObject *obj, GaimConversation *conv) | |
2384 { | |
2385 GaimGtkConversation *gtkconv; | |
2386 int delay; | |
2387 | |
2388 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
2389 return; | |
2390 | |
2391 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2392 | |
8228 | 2393 if (gtkconv->u.im->anim == NULL) |
2394 return; | |
2395 | |
8202 | 2396 if (gtkconv->u.im->icon_timer != 0) |
2397 return; | |
2398 | |
8189 | 2399 if (gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim)) |
2400 return; | |
2401 | |
2402 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter) / 10; | |
2403 | |
8758 | 2404 gtkconv->u.im->icon_timer = g_timeout_add(delay * 10, redraw_icon, conv); |
8189 | 2405 } |
2406 | |
2407 static void | |
2408 stop_anim(GtkObject *obj, GaimConversation *conv) | |
2409 { | |
2410 GaimGtkConversation *gtkconv; | |
2411 | |
2412 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
2413 return; | |
2414 | |
2415 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2416 | |
2417 if (gtkconv->u.im->icon_timer != 0) | |
2418 g_source_remove(gtkconv->u.im->icon_timer); | |
2419 | |
2420 gtkconv->u.im->icon_timer = 0; | |
2421 } | |
2422 | |
2423 static void | |
2424 toggle_icon_animate_cb(GtkWidget *w, GaimConversation *conv) | |
2425 { | |
2426 GaimGtkConversation *gtkconv; | |
2427 | |
2428 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
2429 return; | |
2430 | |
2431 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2432 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2433 gtkconv->u.im->animate = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2434 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w)); |
8189 | 2435 |
2436 if (gtkconv->u.im->animate) | |
2437 start_anim(NULL, conv); | |
2438 else | |
2439 stop_anim(NULL, conv); | |
2440 } | |
2441 static void | |
2442 remove_icon(GaimGtkConversation *gtkconv) | |
2443 { | |
2444 g_return_if_fail(gtkconv != NULL); | |
2445 | |
2446 if (gtkconv->u.im->icon != NULL) | |
8821 | 2447 gtk_widget_destroy(gtkconv->u.im->icon->parent->parent->parent); |
8189 | 2448 |
2449 if (gtkconv->u.im->anim != NULL) | |
2450 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); | |
2451 | |
2452 if (gtkconv->u.im->icon_timer != 0) | |
2453 g_source_remove(gtkconv->u.im->icon_timer); | |
2454 | |
2455 if (gtkconv->u.im->iter != NULL) | |
2456 g_object_unref(G_OBJECT(gtkconv->u.im->iter)); | |
2457 | |
2458 gtkconv->u.im->icon_timer = 0; | |
2459 gtkconv->u.im->icon = NULL; | |
2460 gtkconv->u.im->anim = NULL; | |
2461 gtkconv->u.im->iter = NULL; | |
2462 } | |
2463 | |
2464 static gboolean | |
2465 icon_menu(GtkObject *obj, GdkEventButton *e, GaimConversation *conv) | |
2466 { | |
2467 GaimGtkConversation *gtkconv; | |
2468 static GtkWidget *menu = NULL; | |
2469 GtkWidget *button; | |
2470 | |
2471 if (e->button != 3 || e->type != GDK_BUTTON_PRESS) | |
2472 return FALSE; | |
2473 | |
2474 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2475 | |
2476 /* | |
2477 * If a menu already exists, destroy it before creating a new one, | |
2478 * thus freeing-up the memory it occupied. | |
2479 */ | |
2480 if (menu != NULL) | |
2481 gtk_widget_destroy(menu); | |
2482 | |
2483 menu = gtk_menu_new(); | |
2484 | |
2485 if (gtkconv->u.im->anim && | |
2486 !(gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim))) | |
2487 { | |
2488 gaim_new_check_item(menu, _("Animate"), | |
2489 G_CALLBACK(toggle_icon_animate_cb), conv, | |
2490 gtkconv->u.im->icon_timer); | |
2491 } | |
2492 | |
2493 button = gtk_menu_item_new_with_label(_("Hide Icon")); | |
2494 g_signal_connect_swapped(G_OBJECT(button), "activate", | |
2495 G_CALLBACK(remove_icon), gtkconv); | |
2496 gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); | |
2497 gtk_widget_show(button); | |
2498 | |
2499 gaim_new_item_from_stock(menu, _("Save Icon As..."), GTK_STOCK_SAVE_AS, | |
2500 G_CALLBACK(gaim_gtk_save_icon_dialog), conv, | |
2501 0, 0, NULL); | |
2502 | |
2503 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, e->button, e->time); | |
2504 | |
2505 return TRUE; | |
2506 } | |
2507 /************************************************************************** | |
2508 * End of the bunch of buddy icon functions | |
2509 **************************************************************************/ | |
2510 | |
7887 | 2511 /* |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2512 * Makes sure all the menu items and all the buttons are hidden/shown and |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8730
diff
changeset
|
2513 * sensitive/insensitive. This is called after changing tabs and when an |
7887 | 2514 * account signs on or off. |
2515 */ | |
4359 | 2516 static void |
7887 | 2517 gray_stuff_out(GaimConversation *conv) |
4359 | 2518 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2519 GaimConvWindow *win; |
7887 | 2520 GaimGtkWindow *gtkwin; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2521 GaimGtkConversation *gtkconv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2522 GaimConnection *gc; |
7887 | 2523 GaimPluginProtocolInfo *prpl_info = NULL; |
7222 | 2524 GdkPixbuf *window_icon = NULL; |
8439 | 2525 GtkIMHtmlButtons buttons; |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2526 |
7887 | 2527 win = gaim_conversation_get_window(conv); |
4359 | 2528 gtkwin = GAIM_GTK_WINDOW(win); |
2529 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7887 | 2530 gc = gaim_conversation_get_gc(conv); |
8439 | 2531 |
7879 | 2532 if (gc != NULL) |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
2533 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2534 |
7887 | 2535 if (gtkwin->menu.send_as != NULL) |
2536 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); | |
2537 | |
2538 /* | |
2539 * 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
|
2540 * Stuff that Gaim IMs support in general should be shown for IM |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8730
diff
changeset
|
2541 * conversations. Stuff that Gaim chats support in general should be |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2542 * shown for chat conversations. It doesn't matter whether the PRPL |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2543 * supports it or not--that only affects if the button or menu item |
7929 | 2544 * is sensitive or not. |
7887 | 2545 */ |
4359 | 2546 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
7887 | 2547 /* Show stuff that applies to IMs, hide stuff that applies to chats */ |
2548 | |
2549 /* Deal with buttons */ | |
2550 gtk_widget_show(gtkconv->info); | |
2551 gtk_widget_show(gtkconv->send); | |
2552 gtk_widget_show(gtkconv->u.im->warn); | |
2553 gtk_widget_show(gtkconv->u.im->block); | |
2554 | |
2555 /* Deal with menu items */ | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2556 gtk_widget_show(gtkwin->menu.view_log); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2557 gtk_widget_show(gtkwin->menu.add_pounce); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2558 gtk_widget_show(gtkwin->menu.get_info); |
7887 | 2559 gtk_widget_show(gtkwin->menu.warn); |
7859 | 2560 gtk_widget_hide(gtkwin->menu.invite); |
7887 | 2561 gtk_widget_show(gtkwin->menu.alias); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2562 gtk_widget_show(gtkwin->menu.block); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2563 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2564 if (gaim_find_buddy(gaim_conversation_get_account(conv), |
7143 | 2565 gaim_conversation_get_name(conv)) == NULL) { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2566 gtk_widget_show(gtkwin->menu.add); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2567 gtk_widget_hide(gtkwin->menu.remove); |
7929 | 2568 gtk_widget_show(gtkconv->add); |
2569 gtk_widget_hide(gtkconv->remove); | |
7859 | 2570 } else { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2571 gtk_widget_show(gtkwin->menu.remove); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2572 gtk_widget_hide(gtkwin->menu.add); |
7929 | 2573 gtk_widget_hide(gtkconv->add); |
2574 gtk_widget_show(gtkconv->remove); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2575 } |
7887 | 2576 |
2577 gtk_widget_show(gtkwin->menu.insert_link); | |
9287 | 2578 gtk_widget_show(gtkwin->menu.insert_image); |
7887 | 2579 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { |
2580 /* Show stuff that applies to IMs, hide stuff that applies to chats */ | |
2581 | |
2582 /* Deal with buttons */ | |
7952 | 2583 gtk_widget_show(gtkconv->info); |
7887 | 2584 gtk_widget_show(gtkconv->send); |
2585 gtk_widget_show(gtkconv->u.chat->invite); | |
2586 | |
2587 /* Deal with menu items */ | |
7859 | 2588 gtk_widget_hide(gtkwin->menu.view_log); |
2589 gtk_widget_hide(gtkwin->menu.add_pounce); | |
2590 gtk_widget_hide(gtkwin->menu.get_info); | |
7887 | 2591 gtk_widget_hide(gtkwin->menu.warn); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2592 gtk_widget_show(gtkwin->menu.invite); |
7887 | 2593 gtk_widget_show(gtkwin->menu.alias); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2594 gtk_widget_hide(gtkwin->menu.block); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2595 |
7879 | 2596 if (gaim_blist_find_chat(gaim_conversation_get_account(conv), |
2597 gaim_conversation_get_name(conv)) == NULL) { | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2598 gtk_widget_show(gtkwin->menu.add); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2599 gtk_widget_hide(gtkwin->menu.remove); |
7929 | 2600 gtk_widget_show(gtkconv->add); |
2601 gtk_widget_hide(gtkconv->remove); | |
7859 | 2602 } else { |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2603 gtk_widget_show(gtkwin->menu.remove); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2604 gtk_widget_hide(gtkwin->menu.add); |
7929 | 2605 gtk_widget_hide(gtkconv->add); |
2606 gtk_widget_show(gtkconv->remove); | |
7887 | 2607 } |
2608 | |
2609 gtk_widget_show(gtkwin->menu.insert_link); | |
2610 gtk_widget_hide(gtkwin->menu.insert_image); | |
2611 } | |
2612 | |
2613 /* | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2614 * Handle graying stuff out based on whether an account is connected |
7887 | 2615 * and what features that account supports. |
2616 */ | |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
2617 if ((gc != NULL) && |
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
2618 ( (gaim_conversation_get_type(conv) != GAIM_CONV_CHAT) || |
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
2619 !gaim_conv_chat_has_left(GAIM_CONV_CHAT(conv)) )) { |
7887 | 2620 /* Account is online */ |
2621 | |
2622 /* Deal with buttons */ | |
7929 | 2623 gtk_widget_set_sensitive(gtkconv->add, TRUE); |
2624 gtk_widget_set_sensitive(gtkconv->remove, TRUE); | |
7887 | 2625 gtk_widget_set_sensitive(gtkconv->info, (prpl_info->get_info != NULL)); |
7929 | 2626 |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2627 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2628 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2629 gtk_widget_set_sensitive(gtkconv->send, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2630 (prpl_info->send_im != NULL)); |
7887 | 2631 gtk_widget_set_sensitive(gtkconv->u.im->warn, |
2632 (prpl_info->warn != NULL)); | |
2633 gtk_widget_set_sensitive(gtkconv->u.im->block, | |
2634 (prpl_info->add_deny != NULL)); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2635 } |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2636 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2637 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2638 gtk_widget_set_sensitive(gtkconv->send, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2639 (prpl_info->chat_send != NULL)); |
7887 | 2640 gtk_widget_set_sensitive(gtkconv->u.chat->invite, |
2641 (prpl_info->chat_invite != NULL)); | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
2642 } |
7887 | 2643 |
2644 /* Deal with the toolbar */ | |
8422 | 2645 |
8420 | 2646 if (gc->flags & GAIM_CONNECTION_HTML) { |
8677 | 2647 buttons = GTK_IMHTML_ALL; /* Everything on */ |
8420 | 2648 if (!(prpl_info->options & OPT_PROTO_IM_IMAGE)) |
8422 | 2649 buttons &= ~GTK_IMHTML_IMAGE; |
8420 | 2650 if (gc->flags & GAIM_CONNECTION_NO_BGCOLOR) |
8422 | 2651 buttons &= ~GTK_IMHTML_BACKCOLOR; |
8691
0eb5161ef333
[gaim-migrate @ 9444]
Christian Hammond <chipx86@chipx86.com>
parents:
8690
diff
changeset
|
2652 if (gc->flags & GAIM_CONNECTION_NO_FONTSIZE) { |
0eb5161ef333
[gaim-migrate @ 9444]
Christian Hammond <chipx86@chipx86.com>
parents:
8690
diff
changeset
|
2653 buttons &= ~GTK_IMHTML_GROW; |
0eb5161ef333
[gaim-migrate @ 9444]
Christian Hammond <chipx86@chipx86.com>
parents:
8690
diff
changeset
|
2654 buttons &= ~GTK_IMHTML_SHRINK; |
0eb5161ef333
[gaim-migrate @ 9444]
Christian Hammond <chipx86@chipx86.com>
parents:
8690
diff
changeset
|
2655 } |
9041 | 2656 if (gc->flags & GAIM_CONNECTION_NO_URLDESC) |
2657 buttons &= ~GTK_IMHTML_LINKDESC; | |
8420 | 2658 } else { |
8422 | 2659 buttons = GTK_IMHTML_SMILEY; |
8420 | 2660 } |
2661 gtk_imhtml_set_format_functions(GTK_IMHTML(gtkconv->entry), buttons); | |
8427 | 2662 gtk_imhtmltoolbar_associate_smileys (GTK_IMHTMLTOOLBAR(gtkconv->toolbar), gaim_account_get_protocol_id(gaim_conversation_get_account(conv))); |
8422 | 2663 |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
2664 /* Deal with menu items */ |
7887 | 2665 gtk_widget_set_sensitive(gtkwin->menu.view_log, TRUE); |
2666 gtk_widget_set_sensitive(gtkwin->menu.add_pounce, TRUE); | |
2667 gtk_widget_set_sensitive(gtkwin->menu.get_info, (prpl_info->get_info != NULL)); | |
2668 gtk_widget_set_sensitive(gtkwin->menu.warn, (prpl_info->warn != NULL)); | |
2669 gtk_widget_set_sensitive(gtkwin->menu.invite, | |
2670 (prpl_info->chat_invite != NULL)); | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
2671 |
7887 | 2672 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
2673 if (gaim_find_buddy(gaim_conversation_get_account(conv), | |
2674 gaim_conversation_get_name(conv)) == NULL) | |
2675 gtk_widget_set_sensitive(gtkwin->menu.alias, FALSE); | |
2676 else | |
2677 gtk_widget_set_sensitive(gtkwin->menu.alias, TRUE); | |
2678 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
2679 if (gaim_blist_find_chat(gaim_conversation_get_account(conv), | |
2680 gaim_conversation_get_name(conv)) == NULL) | |
2681 gtk_widget_set_sensitive(gtkwin->menu.alias, FALSE); | |
2682 else | |
2683 gtk_widget_set_sensitive(gtkwin->menu.alias, TRUE); | |
2684 } | |
2685 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2686 gtk_widget_set_sensitive(gtkwin->menu.block, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2687 (prpl_info->add_deny != NULL)); |
7887 | 2688 gtk_widget_set_sensitive(gtkwin->menu.add, TRUE); |
7859 | 2689 gtk_widget_set_sensitive(gtkwin->menu.remove, TRUE); |
8758 | 2690 gtk_widget_set_sensitive(gtkwin->menu.insert_link, |
2691 gc->flags & GAIM_CONNECTION_HTML); | |
7887 | 2692 gtk_widget_set_sensitive(gtkwin->menu.insert_image, |
2693 (prpl_info->options & OPT_PROTO_IM_IMAGE)); | |
2694 } else { | |
2695 /* Account is offline */ | |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
2696 /* Or it's a chat where we left. */ |
7887 | 2697 |
2698 /* Deal with buttons */ | |
7929 | 2699 gtk_widget_set_sensitive(gtkconv->add, FALSE); |
2700 gtk_widget_set_sensitive(gtkconv->remove, FALSE); | |
7887 | 2701 gtk_widget_set_sensitive(gtkconv->info, FALSE); |
2702 gtk_widget_set_sensitive(gtkconv->send, FALSE); | |
2703 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | |
2704 gtk_widget_set_sensitive(gtkconv->u.im->warn, FALSE); | |
2705 gtk_widget_set_sensitive(gtkconv->u.im->block, FALSE); | |
2706 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
2707 gtk_widget_set_sensitive(gtkconv->u.chat->invite, FALSE); | |
2708 } | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2709 |
7887 | 2710 /* Then deal with menu items */ |
2711 gtk_widget_set_sensitive(gtkwin->menu.view_log, TRUE); | |
2712 gtk_widget_set_sensitive(gtkwin->menu.add_pounce, TRUE); | |
2713 gtk_widget_set_sensitive(gtkwin->menu.get_info, FALSE); | |
2714 gtk_widget_set_sensitive(gtkwin->menu.warn, FALSE); | |
2715 gtk_widget_set_sensitive(gtkwin->menu.invite, FALSE); | |
2716 gtk_widget_set_sensitive(gtkwin->menu.alias, FALSE); | |
2717 gtk_widget_set_sensitive(gtkwin->menu.block, FALSE); | |
2718 gtk_widget_set_sensitive(gtkwin->menu.add, FALSE); | |
2719 gtk_widget_set_sensitive(gtkwin->menu.remove, FALSE); | |
7929 | 2720 gtk_widget_set_sensitive(gtkwin->menu.insert_link, TRUE); |
7887 | 2721 gtk_widget_set_sensitive(gtkwin->menu.insert_image, FALSE); |
2722 } | |
2723 | |
2724 /* | |
2725 * Update the window's icon | |
2726 */ | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2727 if ((gaim_conversation_get_type(conv) == GAIM_CONV_IM) && |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2728 (gtkconv->u.im->anim)) |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2729 { |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2730 window_icon = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2731 gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); |
7887 | 2732 g_object_ref(window_icon); |
2733 } else { | |
8748
13d592f485d1
[gaim-migrate @ 9503]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
2734 window_icon = get_tab_icon(conv, FALSE); |
4359 | 2735 } |
7887 | 2736 gtk_window_set_icon(GTK_WINDOW(gtkwin->window), window_icon); |
2737 g_object_unref(G_OBJECT(window_icon)); | |
2738 } | |
2739 | |
2740 static void | |
8189 | 2741 before_switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, |
2742 gpointer user_data) | |
2743 { | |
2744 GaimConvWindow *win; | |
2745 GaimConversation *conv; | |
2746 GaimGtkConversation *gtkconv; | |
2747 | |
2748 win = (GaimConvWindow *)user_data; | |
2749 conv = gaim_conv_window_get_active_conversation(win); | |
2750 | |
2751 g_return_if_fail(conv != NULL); | |
2752 | |
8192 | 2753 if (gaim_conversation_get_type(conv) != GAIM_CONV_IM) |
2754 return; | |
2755 | |
8189 | 2756 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2757 | |
2758 stop_anim(NULL, conv); | |
2759 } | |
2760 | |
2761 static void | |
7887 | 2762 switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, |
2763 gpointer user_data) | |
2764 { | |
2765 GaimConvWindow *win; | |
2766 GaimConversation *conv; | |
2767 GaimGtkConversation *gtkconv; | |
2768 GaimGtkWindow *gtkwin; | |
2769 | |
2770 win = (GaimConvWindow *)user_data; | |
2771 conv = gaim_conv_window_get_conversation_at(win, page_num); | |
2772 | |
2773 g_return_if_fail(conv != NULL); | |
2774 | |
2775 gtkwin = GAIM_GTK_WINDOW(win); | |
2776 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
2777 | |
2778 gaim_conversation_set_unseen(conv, GAIM_UNSEEN_NONE); | |
2779 | |
2780 /* Update the menubar */ | |
2781 gray_stuff_out(conv); | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2782 |
4736 | 2783 update_typing_icon(conv); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2784 |
4359 | 2785 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.logging), |
7143 | 2786 gaim_conversation_is_logging(conv)); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2787 |
4359 | 2788 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.sounds), |
7143 | 2789 gtkconv->make_sound); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2790 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2791 gtk_check_menu_item_set_active( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2792 GTK_CHECK_MENU_ITEM(gtkwin->menu.show_formatting_toolbar), |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2793 gtkconv->show_formatting_toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
2794 |
9188 | 2795 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.show_timestamps), |
2796 gtkconv->show_timestamps); | |
2797 | |
8189 | 2798 /* |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
2799 * We pause icons when they are not visible. If this icon should |
9297 | 2800 * be animated then start it back up again. |
8189 | 2801 */ |
8192 | 2802 if ((gaim_conversation_get_type(conv) == GAIM_CONV_IM) && |
2803 (gtkconv->u.im->animate)) | |
8189 | 2804 start_anim(NULL, conv); |
2805 | |
4965 | 2806 gtk_window_set_title(GTK_WINDOW(gtkwin->window), |
7143 | 2807 gtk_label_get_text(GTK_LABEL(gtkconv->tab_label))); |
4359 | 2808 } |
2809 | |
2810 /************************************************************************** | |
2811 * Utility functions | |
2812 **************************************************************************/ | |
2813 | |
2814 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2815 got_typing_keypress(GaimConversation *conv, gboolean first) |
4359 | 2816 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2817 GaimConvIm *im; |
4685 | 2818 |
4359 | 2819 /* |
2820 * 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
|
2821 * send GAIM_TYPED any time soon. |
4359 | 2822 */ |
2823 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2824 im = GAIM_CONV_IM(conv); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2825 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2826 if (gaim_conv_im_get_type_again_timeout(im)) |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2827 gaim_conv_im_stop_type_again_timeout(im); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2828 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2829 gaim_conv_im_start_type_again_timeout(im); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2830 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2831 if (first || (gaim_conv_im_get_type_again(im) != 0 && |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2832 time(NULL) > gaim_conv_im_get_type_again(im))) { |
4359 | 2833 |
2834 int timeout = serv_send_typing(gaim_conversation_get_gc(conv), | |
2835 (char *)gaim_conversation_get_name(conv), | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
2836 GAIM_TYPING); |
4359 | 2837 |
2838 if (timeout) | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2839 gaim_conv_im_set_type_again(im, time(NULL) + timeout); |
4359 | 2840 else |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2841 gaim_conv_im_set_type_again(im, 0); |
4359 | 2842 } |
2843 } | |
2844 | |
4736 | 2845 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2846 update_typing_icon(GaimConversation *conv) |
4736 | 2847 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2848 GaimGtkWindow *gtkwin; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2849 GaimConvIm *im = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2850 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); |
4736 | 2851 |
2852 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); | |
2853 | |
2854 if(gaim_conversation_get_type(conv) == GAIM_CONV_IM) | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2855 im = GAIM_CONV_IM(conv); |
4736 | 2856 |
2857 if(gtkwin->menu.typing_icon) { | |
2858 gtk_widget_destroy(gtkwin->menu.typing_icon); | |
2859 gtkwin->menu.typing_icon = NULL; | |
2860 } | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2861 if(im && gaim_conv_im_get_typing_state(im) == GAIM_TYPING) { |
4736 | 2862 gtkwin->menu.typing_icon = gtk_image_menu_item_new(); |
2863 gtk_image_menu_item_set_image( | |
2864 GTK_IMAGE_MENU_ITEM(gtkwin->menu.typing_icon), | |
2865 gtk_image_new_from_stock(GAIM_STOCK_TYPING, | |
2866 GTK_ICON_SIZE_MENU)); | |
4757 | 2867 gtk_tooltips_set_tip(gtkconv->tooltips, gtkwin->menu.typing_icon, |
4736 | 2868 _("User is typing..."), NULL); |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2869 } else if(im && gaim_conv_im_get_typing_state(im) == GAIM_TYPED) { |
4736 | 2870 gtkwin->menu.typing_icon = gtk_image_menu_item_new(); |
2871 gtk_image_menu_item_set_image( | |
2872 GTK_IMAGE_MENU_ITEM(gtkwin->menu.typing_icon), | |
2873 gtk_image_new_from_stock(GAIM_STOCK_TYPED, | |
2874 GTK_ICON_SIZE_MENU)); | |
4757 | 2875 gtk_tooltips_set_tip(gtkconv->tooltips, gtkwin->menu.typing_icon, |
4736 | 2876 _("User has typed something and paused"), NULL); |
2877 } | |
2878 | |
2879 if(gtkwin->menu.typing_icon) { | |
2880 gtk_menu_item_set_right_justified( | |
2881 GTK_MENU_ITEM(gtkwin->menu.typing_icon), TRUE); | |
2882 gtk_widget_show_all(gtkwin->menu.typing_icon); | |
2883 gtk_menu_shell_append(GTK_MENU_SHELL(gtkwin->menu.menubar), | |
2884 gtkwin->menu.typing_icon); | |
2885 } | |
2886 } | |
2887 | |
4685 | 2888 static gboolean |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2889 update_send_as_selection(GaimConvWindow *win) |
4359 | 2890 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2891 GaimAccount *account; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2892 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2893 GaimGtkWindow *gtkwin; |
4359 | 2894 GtkWidget *menu; |
2895 GList *child; | |
2896 | |
7090
04f9f7440bc3
[gaim-migrate @ 7655]
Christian Hammond <chipx86@chipx86.com>
parents:
7089
diff
changeset
|
2897 if (g_list_find(gaim_get_windows(), win) == NULL) |
04f9f7440bc3
[gaim-migrate @ 7655]
Christian Hammond <chipx86@chipx86.com>
parents:
7089
diff
changeset
|
2898 return FALSE; |
4849 | 2899 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2900 conv = gaim_conv_window_get_active_conversation(win); |
4359 | 2901 |
5860
52d5fad43950
[gaim-migrate @ 6291]
Christian Hammond <chipx86@chipx86.com>
parents:
5858
diff
changeset
|
2902 if (conv == NULL) |
52d5fad43950
[gaim-migrate @ 6291]
Christian Hammond <chipx86@chipx86.com>
parents:
5858
diff
changeset
|
2903 return FALSE; |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2904 |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2905 account = gaim_conversation_get_account(conv); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2906 gtkwin = GAIM_GTK_WINDOW(win); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2907 |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2908 if (gtkwin->menu.send_as == NULL) |
4685 | 2909 return FALSE; |
4364
fa56829b9587
[gaim-migrate @ 4630]
Christian Hammond <chipx86@chipx86.com>
parents:
4363
diff
changeset
|
2910 |
4359 | 2911 gtk_widget_show(gtkwin->menu.send_as); |
2912 | |
2913 menu = gtk_menu_item_get_submenu( | |
2914 GTK_MENU_ITEM(gtkwin->menu.send_as)); | |
2915 | |
2916 for (child = gtk_container_get_children(GTK_CONTAINER(menu)); | |
2917 child != NULL; | |
2918 child = child->next) { | |
2919 | |
2920 GtkWidget *item = child->data; | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2921 GaimAccount *item_account = g_object_get_data(G_OBJECT(item), |
4673 | 2922 "gaim_account"); |
2923 | |
2924 if (account == item_account) { | |
4359 | 2925 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE); |
2926 break; | |
2927 } | |
2928 } | |
6030
54c37db13279
[gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents:
6016
diff
changeset
|
2929 |
4685 | 2930 return FALSE; |
4359 | 2931 } |
2932 | |
2933 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
2934 generate_send_as_items(GaimConvWindow *win, GaimConversation *deleted_conv) |
4359 | 2935 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2936 GaimGtkWindow *gtkwin; |
4359 | 2937 GtkWidget *menu; |
2938 GtkWidget *menuitem; | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2939 GList *gcs; |
4359 | 2940 GList *convs; |
2941 GSList *group = NULL; | |
2942 gboolean first_offline = TRUE; | |
2943 gboolean found_online = FALSE; | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2944 GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
4359 | 2945 |
2946 gtkwin = GAIM_GTK_WINDOW(win); | |
2947 | |
2948 if (gtkwin->menu.send_as != NULL) | |
2949 gtk_widget_destroy(gtkwin->menu.send_as); | |
2950 | |
2951 /* See if we have > 1 connection active. */ | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2952 if (g_list_length(gaim_connections_get_all()) < 2) { |
4359 | 2953 /* Now make sure we don't have any Offline entries. */ |
2954 gboolean found_offline = FALSE; | |
2955 | |
2956 for (convs = gaim_get_conversations(); | |
2957 convs != NULL; | |
2958 convs = convs->next) { | |
2959 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2960 GaimConversation *conv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2961 GaimAccount *account; |
4491 | 2962 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
2963 conv = (GaimConversation *)convs->data; |
4491 | 2964 account = gaim_conversation_get_account(conv); |
2965 | |
6495
8ce66049ce68
[gaim-migrate @ 7010]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
2966 if (account != NULL && account->gc == NULL) { |
4359 | 2967 found_offline = TRUE; |
2968 break; | |
2969 } | |
2970 } | |
2971 | |
2972 if (!found_offline) { | |
2973 gtkwin->menu.send_as = NULL; | |
2974 return; | |
2975 } | |
2976 } | |
2977 | |
2978 /* Build the Send As menu */ | |
2979 gtkwin->menu.send_as = gtk_menu_item_new_with_mnemonic(_("_Send As")); | |
2980 gtk_widget_show(gtkwin->menu.send_as); | |
2981 | |
2982 menu = gtk_menu_new(); | |
7857
43f63ff8a6d8
[gaim-migrate @ 8511]
Christian Hammond <chipx86@chipx86.com>
parents:
7855
diff
changeset
|
2983 gtk_menu_shell_insert(GTK_MENU_SHELL(gtkwin->menu.menubar), |
43f63ff8a6d8
[gaim-migrate @ 8511]
Christian Hammond <chipx86@chipx86.com>
parents:
7855
diff
changeset
|
2984 gtkwin->menu.send_as, 2); |
4359 | 2985 gtk_menu_item_set_submenu(GTK_MENU_ITEM(gtkwin->menu.send_as), menu); |
2986 | |
2987 gtk_widget_show(menu); | |
2988 | |
2989 /* Fill it with entries. */ | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2990 for (gcs = gaim_connections_get_all(); gcs != NULL; gcs = gcs->next) { |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2991 |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2992 GaimConnection *gc; |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2993 GaimAccount *account; |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2994 GtkWidget *box; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2995 GtkWidget *label; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
2996 GtkWidget *image; |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
2997 GdkPixbuf *pixbuf, *scale; |
4359 | 2998 |
2999 found_online = TRUE; | |
3000 | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3001 gc = (GaimConnection *)gcs->data; |
4359 | 3002 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3003 /* Create a pixmap for the protocol icon. */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3004 pixbuf = create_prpl_icon(gc->account); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3005 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
|
3006 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3007 /* Now convert it to GtkImage */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3008 if (pixbuf == NULL) |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3009 image = gtk_image_new(); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3010 else |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3011 image = gtk_image_new_from_pixbuf(scale); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3012 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3013 gtk_size_group_add_widget(sg, image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3014 |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3015 g_object_unref(G_OBJECT(scale)); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3016 g_object_unref(G_OBJECT(pixbuf)); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3017 |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3018 account = gaim_connection_get_account(gc); |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3019 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3020 /* Make our menu item */ |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3021 menuitem = gtk_radio_menu_item_new_with_label(group, |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3022 gaim_account_get_username(account)); |
4793 | 3023 group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem)); |
4359 | 3024 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3025 /* Do some evil, see some evil, speak some evil. */ |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3026 box = gtk_hbox_new(FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3027 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3028 label = gtk_bin_get_child(GTK_BIN(menuitem)); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3029 g_object_ref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3030 gtk_container_remove(GTK_CONTAINER(menuitem), label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3031 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3032 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3033 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 4); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3034 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3035 g_object_unref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3036 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3037 gtk_container_add(GTK_CONTAINER(menuitem), box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3038 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3039 gtk_widget_show(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3040 gtk_widget_show(image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3041 gtk_widget_show(box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3042 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3043 /* Set our data and callbacks. */ |
4359 | 3044 g_object_set_data(G_OBJECT(menuitem), "user_data", win); |
4673 | 3045 g_object_set_data(G_OBJECT(menuitem), "gaim_account", gc->account); |
4359 | 3046 |
4786 | 3047 g_signal_connect(G_OBJECT(menuitem), "activate", |
4673 | 3048 G_CALLBACK(menu_conv_sel_send_cb), NULL); |
4359 | 3049 |
3050 gtk_widget_show(menuitem); | |
3051 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
3052 } | |
3053 | |
3054 /* | |
3055 * Fill it with any accounts that still has an open (yet disabled) window | |
3056 * (signed off accounts with a window open). | |
3057 */ | |
3058 for (convs = gaim_get_conversations(); | |
3059 convs != NULL; | |
3060 convs = convs->next) { | |
3061 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3062 GaimConversation *conv; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3063 GaimAccount *account; |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3064 GtkWidget *box; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3065 GtkWidget *label; |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3066 GtkWidget *image; |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3067 GdkPixbuf *pixbuf, *scale; |
4359 | 3068 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3069 conv = (GaimConversation *)convs->data; |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3070 |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3071 if (conv == deleted_conv) |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3072 continue; |
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3073 |
4491 | 3074 account = gaim_conversation_get_account(conv); |
3075 | |
6495
8ce66049ce68
[gaim-migrate @ 7010]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
3076 if (account != NULL && account->gc == NULL) { |
4359 | 3077 if (first_offline && found_online) { |
3078 menuitem = gtk_separator_menu_item_new(); | |
3079 gtk_widget_show(menuitem); | |
3080 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
3081 | |
3082 first_offline = FALSE; | |
3083 } | |
3084 | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3085 /* Create a pixmap for the protocol icon. */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3086 pixbuf = create_prpl_icon(account); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3087 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3088 GDK_INTERP_BILINEAR); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3089 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3090 /* Now convert it to GtkImage */ |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3091 if (pixbuf == NULL) |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3092 image = gtk_image_new(); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3093 else |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3094 image = gtk_image_new_from_pixbuf(scale); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3095 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3096 gtk_size_group_add_widget(sg, image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3097 |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3098 if (scale != NULL) g_object_unref(scale); |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
3099 if (pixbuf != NULL) g_object_unref(pixbuf); |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3100 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3101 /* Make our menu item */ |
4359 | 3102 menuitem = gtk_radio_menu_item_new_with_label(group, |
4491 | 3103 account->username); |
4793 | 3104 group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem)); |
4359 | 3105 |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3106 /* Do some evil, see some evil, speak some evil. */ |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3107 box = gtk_hbox_new(FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3108 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3109 label = gtk_bin_get_child(GTK_BIN(menuitem)); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3110 g_object_ref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3111 gtk_container_remove(GTK_CONTAINER(menuitem), label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3112 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3113 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3114 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 4); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3115 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3116 g_object_unref(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3117 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3118 gtk_container_add(GTK_CONTAINER(menuitem), box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3119 |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3120 gtk_widget_show(label); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3121 gtk_widget_show(image); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3122 gtk_widget_show(box); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3123 |
4359 | 3124 gtk_widget_set_sensitive(menuitem, FALSE); |
4786 | 3125 g_object_set_data(G_OBJECT(menuitem), "user_data", win); |
4674 | 3126 g_object_set_data(G_OBJECT(menuitem), "gaim_account", account); |
4359 | 3127 |
4786 | 3128 g_signal_connect(G_OBJECT(menuitem), "activate", |
5902
6889b89cab90
[gaim-migrate @ 6334]
Christian Hammond <chipx86@chipx86.com>
parents:
5901
diff
changeset
|
3129 G_CALLBACK(menu_conv_sel_send_cb), NULL); |
4786 | 3130 |
4359 | 3131 gtk_widget_show(menuitem); |
3132 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
3133 } | |
3134 } | |
3135 | |
4669
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3136 g_object_unref(sg); |
d715736164ae
[gaim-migrate @ 4980]
Christian Hammond <chipx86@chipx86.com>
parents:
4668
diff
changeset
|
3137 |
4359 | 3138 gtk_widget_show(gtkwin->menu.send_as); |
3139 update_send_as_selection(win); | |
3140 } | |
3141 | |
3142 static GList * | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3143 generate_invite_user_names(GaimConnection *gc) |
4359 | 3144 { |
6695 | 3145 GaimBlistNode *gnode,*cnode,*bnode; |
4359 | 3146 static GList *tmp = NULL; |
3147 | |
3148 if (tmp) | |
3149 g_list_free(tmp); | |
3150 | |
3151 tmp = g_list_append(NULL, ""); | |
3152 | |
3153 if (gc != NULL) { | |
4785 | 3154 for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { |
3155 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) | |
3156 continue; | |
6695 | 3157 for(cnode = gnode->child; cnode; cnode = cnode->next) { |
3158 if(!GAIM_BLIST_NODE_IS_CONTACT(cnode)) | |
4785 | 3159 continue; |
6695 | 3160 for(bnode = cnode->child; bnode; bnode = bnode->next) { |
3161 GaimBuddy *buddy; | |
3162 | |
3163 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) | |
3164 continue; | |
3165 | |
3166 buddy = (GaimBuddy *)bnode; | |
3167 | |
3168 if (buddy->account == gc->account && | |
3169 GAIM_BUDDY_IS_ONLINE(buddy)) | |
3170 tmp = g_list_append(tmp, buddy->name); | |
3171 } | |
4359 | 3172 } |
3173 } | |
3174 } | |
3175 | |
3176 return tmp; | |
3177 } | |
3178 | |
3179 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3180 add_chat_buddy_common(GaimConversation *conv, const char *name, int pos) |
4359 | 3181 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3182 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3183 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3184 GaimConvChat *chat; |
4359 | 3185 GtkTreeIter iter; |
3186 GtkListStore *ls; | |
3187 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3188 chat = GAIM_CONV_CHAT(conv); |
4359 | 3189 gtkconv = GAIM_GTK_CONVERSATION(conv); |
3190 gtkchat = gtkconv->u.chat; | |
3191 | |
3192 ls = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list))); | |
3193 | |
3194 gtk_list_store_append(ls, &iter); | |
3195 gtk_list_store_set(ls, &iter, 0, | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3196 (gaim_conv_chat_is_user_ignored(chat, name) ? "X" : " "), |
4359 | 3197 1, name, -1); |
3198 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), 1, | |
3199 GTK_SORT_ASCENDING); | |
3200 } | |
3201 | |
3202 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3203 tab_complete(GaimConversation *conv) |
4359 | 3204 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3205 GaimGtkConversation *gtkconv; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3206 GaimConvChat *chat; |
4359 | 3207 GtkTextIter cursor, word_start, start_buffer; |
3208 int start; | |
3209 int most_matched = -1; | |
3210 char *entered, *partial = NULL; | |
3211 char *text; | |
8021 | 3212 char *nick_partial; |
4359 | 3213 GList *matches = NULL; |
3214 GList *nicks = NULL; | |
3215 | |
3216 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3217 chat = GAIM_CONV_CHAT(conv); |
4359 | 3218 |
3219 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_buffer); | |
3220 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, | |
3221 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
3222 | |
3223 word_start = cursor; | |
3224 | |
3225 /* if there's nothing there just return */ | |
3226 if (!gtk_text_iter_compare(&cursor, &start_buffer)) | |
3227 return; | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
3228 |
4359 | 3229 text = gtk_text_buffer_get_text(gtkconv->entry_buffer, &start_buffer, |
3230 &cursor, FALSE); | |
3231 | |
3232 /* if we're at the end of ": " we need to move back 2 spaces */ | |
3233 start = strlen(text) - 1; | |
3234 | |
8021 | 3235 if (strlen(text) >= 2 && !strncmp(&text[start-1], ": ", 2)) { |
4359 | 3236 gtk_text_iter_backward_chars(&word_start, 2); |
8021 | 3237 start-=2; |
3238 } | |
4359 | 3239 |
3240 /* find the start of the word that we're tabbing */ | |
3241 while (start >= 0 && text[start] != ' ') { | |
3242 gtk_text_iter_backward_char(&word_start); | |
3243 start--; | |
3244 } | |
3245 | |
3246 g_free(text); | |
3247 | |
3248 entered = gtk_text_buffer_get_text(gtkconv->entry_buffer, &word_start, | |
3249 &cursor, FALSE); | |
3250 | |
8021 | 3251 if (!g_utf8_strlen(entered, -1)) { |
4359 | 3252 g_free(entered); |
3253 return; | |
3254 } | |
3255 | |
8021 | 3256 nick_partial = g_malloc(strlen(entered)+1); |
3257 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3258 for (nicks = gaim_conv_chat_get_users(chat); |
4359 | 3259 nicks != NULL; |
3260 nicks = nicks->next) { | |
3261 | |
3262 char *nick = nicks->data; | |
8021 | 3263 |
8159 | 3264 strncpy(nick_partial, nick, strlen(entered)); |
8172 | 3265 nick_partial[strlen(entered)] = '\0'; |
8021 | 3266 if(gaim_utf8_strcasecmp(nick_partial, entered)) |
3267 continue; | |
4359 | 3268 |
3269 /* if we're here, it's a possible completion */ | |
3270 | |
3271 if (most_matched == -1) { | |
3272 /* | |
3273 * this will only get called once, since from now | |
3274 * on most_matched is >= 0 | |
3275 */ | |
3276 most_matched = strlen(nick); | |
3277 partial = g_strdup(nick); | |
3278 } | |
3279 else if (most_matched) { | |
8021 | 3280 char *tmp = g_strdup(nick); |
3281 | |
3282 while (gaim_utf8_strcasecmp(tmp, partial)) { | |
3283 partial[most_matched] = '\0'; | |
3284 if(most_matched < strlen(tmp)) | |
3285 tmp[most_matched] = '\0'; | |
4359 | 3286 most_matched--; |
8021 | 3287 } |
8079 | 3288 most_matched++; |
8021 | 3289 |
3290 g_free(tmp); | |
4359 | 3291 } |
3292 | |
3293 matches = g_list_append(matches, nick); | |
3294 } | |
3295 | |
8021 | 3296 g_free(nick_partial); |
3297 | |
4359 | 3298 /* we're only here if we're doing new style */ |
3299 | |
3300 /* if there weren't any matches, return */ | |
3301 if (!matches) { | |
3302 /* if matches isn't set partials won't be either */ | |
3303 g_free(entered); | |
3304 return; | |
3305 } | |
3306 | |
3307 gtk_text_buffer_delete(gtkconv->entry_buffer, &word_start, &cursor); | |
3308 | |
3309 if (!matches->next) { | |
3310 /* there was only one match. fill it in. */ | |
3311 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_buffer); | |
3312 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor, | |
3313 gtk_text_buffer_get_insert(gtkconv->entry_buffer)); | |
3314 | |
3315 if (!gtk_text_iter_compare(&cursor, &start_buffer)) { | |
3316 char *tmp = g_strdup_printf("%s: ", (char *)matches->data); | |
3317 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, tmp, -1); | |
3318 g_free(tmp); | |
3319 } | |
3320 else | |
3321 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, | |
3322 matches->data, -1); | |
3323 | |
3324 matches = g_list_remove(matches, matches->data); | |
3325 } | |
3326 else { | |
3327 /* | |
3328 * there were lots of matches, fill in as much as possible | |
3329 * and display all of them | |
3330 */ | |
3331 char *addthis = g_malloc0(1); | |
3332 | |
3333 while (matches) { | |
3334 char *tmp = addthis; | |
3335 addthis = g_strconcat(tmp, matches->data, " ", NULL); | |
3336 g_free(tmp); | |
3337 matches = g_list_remove(matches, matches->data); | |
3338 } | |
3339 | |
6982 | 3340 gaim_conversation_write(conv, NULL, addthis, GAIM_MESSAGE_NO_LOG, |
4359 | 3341 time(NULL)); |
3342 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, partial, -1); | |
3343 g_free(addthis); | |
3344 } | |
3345 | |
3346 g_free(entered); | |
3347 g_free(partial); | |
3348 } | |
3349 | |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3350 static void |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3351 save_convo(GtkWidget *save, GaimConversation *c) |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3352 { |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3353 char buf[BUF_LONG]; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3354 GtkWidget *window; |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3355 |
7859 | 3356 window = gtk_file_selection_new(_("Save Conversation")); |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3357 |
8557 | 3358 g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S "%s.html", |
7261 | 3359 gaim_home_dir(), gaim_normalize(c->account, c->name)); |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3360 gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3361 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
|
3362 "gaim_conversation", c); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3363 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(window)->ok_button), |
6038 | 3364 "clicked", G_CALLBACK(do_check_save_convo), window); |
5934
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3365 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
|
3366 "clicked", G_CALLBACK(gtk_widget_destroy), (gpointer)window); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3367 gtk_widget_show(window); |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3368 } |
91ee71a394be
[gaim-migrate @ 6374]
Christian Hammond <chipx86@chipx86.com>
parents:
5929
diff
changeset
|
3369 |
4359 | 3370 static GtkItemFactoryEntry menu_items[] = |
3371 { | |
3372 /* Conversation menu */ | |
4596 | 3373 { N_("/_Conversation"), NULL, NULL, 0, "<Branch>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3374 |
7887 | 3375 { N_("/Conversation/New Instant _Message..."), "<CTL>M", menu_new_conv_cb, |
7859 | 3376 0, "<StockItem>", GAIM_STOCK_IM }, |
3377 | |
3378 { "/Conversation/sep0", NULL, NULL, 0, "<Separator>" }, | |
3379 | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3380 { N_("/Conversation/_Find..."), NULL, menu_find_cb, 0, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3381 "<StockItem>", GTK_STOCK_FIND }, |
7859 | 3382 { N_("/Conversation/View _Log"), NULL, menu_view_log_cb, 0, NULL }, |
4596 | 3383 { N_("/Conversation/_Save As..."), NULL, menu_save_as_cb, 0, |
4359 | 3384 "<StockItem>", GTK_STOCK_SAVE_AS }, |
8974 | 3385 { N_("/Conversation/Clear"), "<CTL>L", menu_clear_cb, 0, "<StockItem>", GTK_STOCK_CLEAR }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3386 |
4359 | 3387 { "/Conversation/sep1", NULL, NULL, 0, "<Separator>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3388 |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
3389 { N_("/Conversation/Add Buddy _Pounce..."), NULL, menu_add_pounce_cb, |
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
3390 0, NULL }, |
7859 | 3391 { N_("/Conversation/_Get Info"), NULL, menu_get_info_cb, 0, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3392 "<StockItem>", GAIM_STOCK_INFO }, |
7859 | 3393 { N_("/Conversation/_Warn..."), NULL, menu_warn_cb, 0, |
3394 "<StockItem>", GAIM_STOCK_WARN }, | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3395 { N_("/Conversation/In_vite..."), NULL, menu_invite_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3396 "<StockItem>", GAIM_STOCK_INVITE }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3397 |
5907
18486c860a46
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5902
diff
changeset
|
3398 { "/Conversation/sep2", NULL, NULL, 0, "<Separator>" }, |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3399 |
7859 | 3400 { N_("/Conversation/A_lias..."), NULL, menu_alias_cb, 0, |
3401 "<StockItem>", GAIM_STOCK_EDIT }, | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3402 { N_("/Conversation/_Block..."), NULL, menu_block_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3403 "<StockItem>", GAIM_STOCK_BLOCK }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3404 { N_("/Conversation/_Add..."), NULL, menu_add_remove_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3405 "<StockItem>", GTK_STOCK_ADD }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3406 { N_("/Conversation/_Remove..."), NULL, menu_add_remove_cb, 0, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3407 "<StockItem>", GTK_STOCK_REMOVE }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3408 |
7859 | 3409 { "/Conversation/sep3", NULL, NULL, 0, "<Separator>" }, |
3410 | |
8756 | 3411 { N_("/Conversation/Insert Lin_k..."), NULL, menu_insert_link_cb, 0, |
7859 | 3412 "<StockItem>", GAIM_STOCK_LINK }, |
9287 | 3413 { N_("/Conversation/Insert Imag_e..."), NULL, menu_insert_image_cb, 0, |
7859 | 3414 "<StockItem>", GAIM_STOCK_IMAGE }, |
3415 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3416 { "/Conversation/sep4", NULL, NULL, 0, "<Separator>" }, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3417 |
4596 | 3418 { N_("/Conversation/_Close"), NULL, menu_close_conv_cb, 0, |
4359 | 3419 "<StockItem>", GTK_STOCK_CLOSE }, |
3420 | |
3421 /* Options */ | |
4596 | 3422 { N_("/_Options"), NULL, NULL, 0, "<Branch>" }, |
3423 { N_("/Options/Enable _Logging"), NULL, menu_logging_cb, 0, "<CheckItem>" }, | |
3424 { N_("/Options/Enable _Sounds"), NULL, menu_sounds_cb, 0, "<CheckItem>" }, | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3425 { N_("/Options/Show Formatting _Toolbar"), NULL, menu_toolbar_cb, 0, "<CheckItem>" }, |
9188 | 3426 { N_("/Options/Show T_imestamps"), "F2", menu_timestamps_cb, 0, "<CheckItem>" }, |
4359 | 3427 }; |
3428 | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
3429 static const int menu_item_count = |
4359 | 3430 sizeof(menu_items) / sizeof(*menu_items); |
3431 | |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3432 static char * |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3433 item_factory_translate_func (const char *path, gpointer func_data) |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3434 { |
7386 | 3435 return _((char *)path); |
4602
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3436 } |
4128761bacb8
[gaim-migrate @ 4889]
Christian Hammond <chipx86@chipx86.com>
parents:
4598
diff
changeset
|
3437 |
4359 | 3438 static GtkWidget * |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
3439 setup_menubar(GaimConvWindow *win) |
4359 | 3440 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3441 GaimGtkWindow *gtkwin; |
5116 | 3442 GtkAccelGroup *accel_group; |
4359 | 3443 gtkwin = GAIM_GTK_WINDOW(win); |
3444 | |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
3445 accel_group = gtk_accel_group_new (); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
3446 gtk_window_add_accel_group (GTK_WINDOW (gtkwin->window), accel_group); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
3447 g_object_unref (accel_group); |
5116 | 3448 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3449 gtkwin->menu.item_factory = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3450 gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<main>", accel_group); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3451 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3452 gtk_item_factory_set_translate_func(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3453 item_factory_translate_func, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3454 NULL, NULL); |
4630 | 3455 |
3456 gtk_item_factory_create_items(gtkwin->menu.item_factory, menu_item_count, | |
4359 | 3457 menu_items, win); |
7420 | 3458 g_signal_connect(G_OBJECT(accel_group), "accel-changed", |
3459 G_CALLBACK(gaim_gtk_save_accels_cb), NULL); | |
4359 | 3460 |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3461 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3462 gtkwin->menu.menubar = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3463 gtk_item_factory_get_widget(gtkwin->menu.item_factory, "<main>"); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3464 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3465 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3466 gtkwin->menu.view_log = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3467 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
7295 | 3468 N_("/Conversation/View Log")); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3469 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3470 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3471 gtkwin->menu.add_pounce = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3472 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3473 N_("/Conversation/Add Buddy Pounce...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3474 |
7879 | 3475 /* --- */ |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3476 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3477 gtkwin->menu.get_info = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3478 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
7859 | 3479 N_("/Conversation/Get Info")); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3480 |
7879 | 3481 gtkwin->menu.warn = |
3482 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3483 N_("/Conversation/Warn...")); | |
3484 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3485 gtkwin->menu.invite = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3486 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3487 N_("/Conversation/Invite...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3488 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3489 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3490 |
7879 | 3491 gtkwin->menu.alias = |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3492 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
7879 | 3493 N_("/Conversation/Alias...")); |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3494 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3495 gtkwin->menu.block = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3496 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3497 N_("/Conversation/Block...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3498 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3499 gtkwin->menu.add = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3500 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3501 N_("/Conversation/Add...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3502 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3503 gtkwin->menu.remove = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3504 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3505 N_("/Conversation/Remove...")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3506 |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3507 /* --- */ |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3508 |
7879 | 3509 gtkwin->menu.insert_link = |
3510 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3511 N_("/Conversation/Insert Link...")); | |
3512 | |
3513 gtkwin->menu.insert_image = | |
3514 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3515 N_("/Conversation/Insert Image...")); | |
3516 | |
3517 /* --- */ | |
3518 | |
5908
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3519 gtkwin->menu.logging = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3520 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3521 N_("/Options/Enable Logging")); |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3522 gtkwin->menu.sounds = |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3523 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
ed8a9a3bf7e2
[gaim-migrate @ 6340]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
3524 N_("/Options/Enable Sounds")); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3525 gtkwin->menu.show_formatting_toolbar = |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3526 gtk_item_factory_get_widget(gtkwin->menu.item_factory, |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
3527 N_("/Options/Show Formatting Toolbar")); |
9188 | 3528 gtkwin->menu.show_timestamps = |
3529 gtk_item_factory_get_widget(gtkwin->menu.item_factory, | |
3530 N_("/Options/Show Timestamps")); | |
4359 | 3531 |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
3532 generate_send_as_items(win, NULL); |
4359 | 3533 |
3534 gtk_widget_show(gtkwin->menu.menubar); | |
4931 | 3535 |
3536 return gtkwin->menu.menubar; | |
4359 | 3537 } |
3538 | |
3539 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3540 setup_im_buttons(GaimConversation *conv, GtkWidget *parent) |
4359 | 3541 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3542 GaimConnection *gc; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3543 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3544 GaimGtkImPane *gtkim; |
8811 | 3545 GaimButtonStyle button_type; |
4359 | 3546 |
3547 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3548 gtkim = gtkconv->u.im; | |
3549 gc = gaim_conversation_get_gc(conv); | |
3550 | |
3551 /* From right to left... */ | |
3552 | |
3553 /* Send button */ | |
3554 gtkconv->send = gaim_gtk_change_text(_("Send"), gtkconv->send, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3555 GAIM_STOCK_SEND, GAIM_CONV_IM); |
4359 | 3556 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->send, _("Send"), NULL); |
3557 gtk_box_pack_end(GTK_BOX(parent), gtkconv->send, FALSE, FALSE, 0); | |
3558 | |
3559 /* Separator */ | |
3560 if (gtkim->sep2 != NULL) | |
3561 gtk_widget_destroy(gtkim->sep2); | |
3562 | |
3563 gtkim->sep2 = gtk_vseparator_new(); | |
3564 gtk_box_pack_end(GTK_BOX(parent), gtkim->sep2, FALSE, TRUE, 0); | |
3565 gtk_widget_show(gtkim->sep2); | |
3566 | |
3567 /* Now, um, just kind of all over the place. Huh? */ | |
3568 | |
3569 /* Warn button */ | |
3570 gtkim->warn = gaim_gtk_change_text(_("Warn"), gtkim->warn, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3571 GAIM_STOCK_WARN, GAIM_CONV_IM); |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3572 gtk_tooltips_set_tip(gtkconv->tooltips, gtkim->warn, |
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3573 _("Warn the user"), NULL); |
7929 | 3574 gtk_box_pack_start(GTK_BOX(parent), gtkim->warn, FALSE, FALSE, 0); |
3575 | |
3576 /* Block button */ | |
3577 gtkim->block = gaim_gtk_change_text(_("Block"), gtkim->block, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3578 GAIM_STOCK_BLOCK, GAIM_CONV_IM); |
7929 | 3579 gtk_tooltips_set_tip(gtkconv->tooltips, gtkim->block, |
3580 _("Block the user"), NULL); | |
3581 gtk_box_pack_start(GTK_BOX(parent), gtkim->block, FALSE, FALSE, 0); | |
3582 | |
3583 /* Add button */ | |
3584 gtkconv->add = gaim_gtk_change_text(_("Add"), gtkconv->add, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3585 GTK_STOCK_ADD, GAIM_CONV_IM); |
7929 | 3586 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->add, |
3587 _("Add the user to your buddy list"), NULL); | |
3588 gtk_box_pack_start(GTK_BOX(parent), gtkconv->add, FALSE, FALSE, 0); | |
3589 | |
3590 /* Remove button */ | |
3591 gtkconv->remove = gaim_gtk_change_text(_("Remove"), gtkconv->remove, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3592 GTK_STOCK_REMOVE, GAIM_CONV_IM); |
7929 | 3593 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->remove, |
3594 _("Remove the user from your buddy list"), NULL); | |
3595 gtk_box_pack_start(GTK_BOX(parent), gtkconv->remove, FALSE, FALSE, 0); | |
4359 | 3596 |
3597 /* Info button */ | |
3598 gtkconv->info = gaim_gtk_change_text(_("Info"), gtkconv->info, | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3599 GAIM_STOCK_INFO, GAIM_CONV_IM); |
4359 | 3600 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->info, |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3601 _("Get the user's information"), NULL); |
7929 | 3602 gtk_box_pack_start(GTK_BOX(parent), gtkconv->info, FALSE, FALSE, 0); |
3603 | |
3604 gtk_button_set_relief(GTK_BUTTON(gtkim->warn), GTK_RELIEF_NONE); | |
3605 gtk_button_set_relief(GTK_BUTTON(gtkim->block), GTK_RELIEF_NONE); | |
3606 gtk_button_set_relief(GTK_BUTTON(gtkconv->add), GTK_RELIEF_NONE); | |
3607 gtk_button_set_relief(GTK_BUTTON(gtkconv->remove), GTK_RELIEF_NONE); | |
4359 | 3608 gtk_button_set_relief(GTK_BUTTON(gtkconv->info), GTK_RELIEF_NONE); |
3609 gtk_button_set_relief(GTK_BUTTON(gtkconv->send), GTK_RELIEF_NONE); | |
7929 | 3610 |
3611 gtk_size_group_add_widget(gtkconv->sg, gtkim->warn); | |
3612 gtk_size_group_add_widget(gtkconv->sg, gtkim->block); | |
3613 gtk_size_group_add_widget(gtkconv->sg, gtkconv->add); | |
3614 gtk_size_group_add_widget(gtkconv->sg, gtkconv->remove); | |
4359 | 3615 gtk_size_group_add_widget(gtkconv->sg, gtkconv->info); |
3616 gtk_size_group_add_widget(gtkconv->sg, gtkconv->send); | |
7929 | 3617 |
3618 gtk_box_reorder_child(GTK_BOX(parent), gtkim->warn, 1); | |
3619 gtk_box_reorder_child(GTK_BOX(parent), gtkim->block, 2); | |
3620 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->add, 3); | |
3621 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->remove, 4); | |
3622 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->info, 5); | |
4359 | 3623 |
3624 gaim_gtkconv_update_buttons_by_protocol(conv); | |
3625 | |
8811 | 3626 /* Check if the buttons should be visible or not */ |
9150 | 3627 button_type = gaim_prefs_get_int("/gaim/gtk/conversations/button_type"); |
8811 | 3628 if (button_type == GAIM_BUTTON_NONE) |
3629 gtk_widget_hide(gtkconv->bbox); | |
3630 else | |
3631 gtk_widget_show(gtkconv->bbox); | |
3632 | |
4359 | 3633 g_signal_connect(G_OBJECT(gtkim->warn), "clicked", |
3634 G_CALLBACK(warn_cb), conv); | |
3635 g_signal_connect(G_OBJECT(gtkim->block), "clicked", | |
3636 G_CALLBACK(block_cb), conv); | |
7929 | 3637 g_signal_connect(G_OBJECT(gtkconv->add), "clicked", |
3638 G_CALLBACK(add_remove_cb), conv); | |
3639 g_signal_connect(G_OBJECT(gtkconv->remove), "clicked", | |
3640 G_CALLBACK(add_remove_cb), conv); | |
3641 g_signal_connect(G_OBJECT(gtkconv->info), "clicked", | |
3642 G_CALLBACK(info_cb), conv); | |
3643 g_signal_connect(G_OBJECT(gtkconv->send), "clicked", | |
3644 G_CALLBACK(send_cb), conv); | |
4359 | 3645 } |
3646 | |
3647 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3648 setup_chat_buttons(GaimConversation *conv, GtkWidget *parent) |
4359 | 3649 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3650 GaimConnection *gc; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3651 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3652 GaimGtkChatPane *gtkchat; |
8811 | 3653 GaimButtonStyle button_type; |
4359 | 3654 |
3655 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3656 gtkchat = gtkconv->u.chat; | |
3657 gc = gaim_conversation_get_gc(conv); | |
3658 | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3659 /* From right to left... */ |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3660 |
4359 | 3661 /* Send button */ |
3662 gtkconv->send = gaim_gtk_change_text(_("Send"), gtkconv->send, | |
3663 GAIM_STOCK_SEND, GAIM_CONV_CHAT); | |
3664 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->send, _("Send"), NULL); | |
3665 gtk_box_pack_end(GTK_BOX(parent), gtkconv->send, FALSE, FALSE, 0); | |
3666 | |
3667 /* Separator */ | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3668 if (gtkchat->sep != NULL) |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3669 gtk_widget_destroy(gtkchat->sep); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3670 |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3671 gtkchat->sep = gtk_vseparator_new(); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3672 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
|
3673 gtk_widget_show(gtkchat->sep); |
4359 | 3674 |
3675 /* Invite */ | |
3676 gtkchat->invite = gaim_gtk_change_text(_("Invite"), gtkchat->invite, | |
3677 GAIM_STOCK_INVITE, GAIM_CONV_CHAT); | |
3678 gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->invite, | |
3679 _("Invite a user"), NULL); | |
7931 | 3680 gtk_box_pack_start(GTK_BOX(parent), gtkchat->invite, FALSE, FALSE, 0); |
4359 | 3681 |
7929 | 3682 /* Add button */ |
3683 gtkconv->add = gaim_gtk_change_text(_("Add"), gtkconv->add, | |
3684 GTK_STOCK_ADD, GAIM_CONV_CHAT); | |
3685 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->add, | |
3686 _("Add the chat to your buddy list"), NULL); | |
3687 gtk_box_pack_start(GTK_BOX(parent), gtkconv->add, FALSE, FALSE, 0); | |
3688 | |
3689 /* Remove button */ | |
3690 gtkconv->remove = gaim_gtk_change_text(_("Remove"), gtkconv->remove, | |
3691 GTK_STOCK_REMOVE, GAIM_CONV_CHAT); | |
3692 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->remove, | |
3693 _("Remove the chat from your buddy list"), NULL); | |
3694 gtk_box_pack_start(GTK_BOX(parent), gtkconv->remove, FALSE, FALSE, 0); | |
3695 | |
4359 | 3696 /* Set the relief on these. */ |
3697 gtk_button_set_relief(GTK_BUTTON(gtkchat->invite), GTK_RELIEF_NONE); | |
7929 | 3698 gtk_button_set_relief(GTK_BUTTON(gtkconv->add), GTK_RELIEF_NONE); |
3699 gtk_button_set_relief(GTK_BUTTON(gtkconv->remove), GTK_RELIEF_NONE); | |
4359 | 3700 gtk_button_set_relief(GTK_BUTTON(gtkconv->send), GTK_RELIEF_NONE); |
3701 | |
7996
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3702 gtk_size_group_add_widget(gtkconv->sg, gtkchat->invite); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3703 gtk_size_group_add_widget(gtkconv->sg, gtkconv->add); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3704 gtk_size_group_add_widget(gtkconv->sg, gtkconv->remove); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3705 gtk_size_group_add_widget(gtkconv->sg, gtkconv->send); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3706 |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3707 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->add, 1); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3708 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->remove, 3); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3709 gtk_box_reorder_child(GTK_BOX(parent), gtkchat->invite, 3); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3710 |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3711 gaim_gtkconv_update_buttons_by_protocol(conv); |
334ab1319406
[gaim-migrate @ 8673]
Christian Hammond <chipx86@chipx86.com>
parents:
7995
diff
changeset
|
3712 |
8811 | 3713 /* Check if the buttons should be visible or not */ |
9150 | 3714 button_type = gaim_prefs_get_int("/gaim/gtk/conversations/button_type"); |
8811 | 3715 if (button_type == GAIM_BUTTON_NONE) |
3716 gtk_widget_hide(gtkconv->bbox); | |
3717 else | |
3718 gtk_widget_show(gtkconv->bbox); | |
3719 | |
4359 | 3720 /* Callbacks */ |
7929 | 3721 g_signal_connect(G_OBJECT(gtkchat->invite), "clicked", |
3722 G_CALLBACK(invite_cb), conv); | |
3723 g_signal_connect(G_OBJECT(gtkconv->add), "clicked", | |
3724 G_CALLBACK(add_remove_cb), conv); | |
3725 g_signal_connect(G_OBJECT(gtkconv->remove), "clicked", | |
3726 G_CALLBACK(add_remove_cb), conv); | |
4359 | 3727 g_signal_connect(G_OBJECT(gtkconv->send), "clicked", |
3728 G_CALLBACK(send_cb), conv); | |
3729 } | |
3730 | |
3731 | |
7971 | 3732 static void topic_callback(GtkWidget *w, GaimConversation *conv) |
3733 { | |
3734 GaimPluginProtocolInfo *prpl_info = NULL; | |
3735 GaimConnection *gc; | |
3736 GaimGtkConversation *gtkconv; | |
3737 GaimGtkChatPane *gtkchat; | |
8858 | 3738 const char *new_topic; |
3739 const char *current_topic; | |
7971 | 3740 |
3741 gc = gaim_conversation_get_gc(conv); | |
3742 | |
3743 if(!gc || !(prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl))) | |
3744 return; | |
3745 | |
3746 if(prpl_info->set_chat_topic == NULL) | |
3747 return; | |
3748 | |
3749 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3750 gtkchat = gtkconv->u.chat; | |
8858 | 3751 new_topic = gtk_entry_get_text(GTK_ENTRY(gtkchat->topic_text)); |
3752 current_topic = gaim_conv_chat_get_topic(GAIM_CONV_CHAT(conv)); | |
3753 | |
3754 if(current_topic && !g_utf8_collate(new_topic, current_topic)) | |
7971 | 3755 return; |
3756 | |
8858 | 3757 prpl_info->set_chat_topic(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), |
3758 new_topic); | |
7971 | 3759 } |
3760 | |
4359 | 3761 static GtkWidget * |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3762 setup_chat_pane(GaimConversation *conv) |
4359 | 3763 { |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3764 GaimPluginProtocolInfo *prpl_info = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3765 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
3766 GaimGtkChatPane *gtkchat; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
3767 GaimConnection *gc; |
8456 | 3768 GaimPlugin *protocol; |
4359 | 3769 GtkWidget *vpaned, *hpaned; |
3770 GtkWidget *vbox, *hbox; | |
3771 GtkWidget *lbox, *bbox; | |
3772 GtkWidget *label; | |
3773 GtkWidget *list; | |
3774 GtkWidget *button; | |
7949 | 3775 GtkWidget *sw; |
4359 | 3776 GtkListStore *ls; |
3777 GtkCellRenderer *rend; | |
3778 GtkTreeViewColumn *col; | |
9080 | 3779 GList *focus_chain = NULL; |
4359 | 3780 |
3781 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
3782 gtkchat = gtkconv->u.chat; | |
3783 gc = gaim_conversation_get_gc(conv); | |
3784 | |
3785 /* Setup the outer pane. */ | |
3786 vpaned = gtk_vpaned_new(); | |
3787 gtk_widget_show(vpaned); | |
3788 | |
3789 /* Setup the top part of the pane. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3790 vbox = gtk_vbox_new(FALSE, 6); |
8914 | 3791 gtk_paned_pack1(GTK_PANED(vpaned), vbox, TRUE, TRUE); |
4359 | 3792 gtk_widget_show(vbox); |
3793 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3794 if (gc != NULL) |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3795 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3796 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
3797 if (prpl_info->options & OPT_PROTO_CHAT_TOPIC) |
4359 | 3798 { |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3799 hbox = gtk_hbox_new(FALSE, 6); |
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3800 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
4359 | 3801 gtk_widget_show(hbox); |
3802 | |
3803 label = gtk_label_new(_("Topic:")); | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3804 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
4359 | 3805 gtk_widget_show(label); |
3806 | |
3807 gtkchat->topic_text = gtk_entry_new(); | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3808 |
7971 | 3809 if(prpl_info->set_chat_topic == NULL) { |
3810 gtk_editable_set_editable(GTK_EDITABLE(gtkchat->topic_text), FALSE); | |
3811 } else { | |
3812 g_signal_connect(GTK_OBJECT(gtkchat->topic_text), "activate", | |
3813 G_CALLBACK(topic_callback), conv); | |
3814 } | |
3815 | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3816 gtk_box_pack_start(GTK_BOX(hbox), gtkchat->topic_text, TRUE, TRUE, 0); |
4359 | 3817 gtk_widget_show(gtkchat->topic_text); |
3818 } | |
3819 | |
3820 /* Setup the horizontal pane. */ | |
3821 hpaned = gtk_hpaned_new(); | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3822 gtk_box_pack_start(GTK_BOX(vbox), hpaned, TRUE, TRUE, 0); |
4359 | 3823 gtk_widget_show(hpaned); |
3824 | |
3825 /* Setup the scrolled window to put gtkimhtml in. */ | |
3826 gtkconv->sw = gtk_scrolled_window_new(NULL, NULL); | |
3827 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
8076 | 3828 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
4359 | 3829 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(gtkconv->sw), |
3830 GTK_SHADOW_IN); | |
3831 gtk_paned_pack1(GTK_PANED(hpaned), gtkconv->sw, TRUE, TRUE); | |
3832 | |
3833 gtk_widget_set_size_request(gtkconv->sw, | |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3834 gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_width"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3835 gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_height")); |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
3836 |
8914 | 3837 g_signal_connect(G_OBJECT(gtkconv->sw), "size-allocate", |
3838 G_CALLBACK(size_allocate_cb), conv); | |
3839 | |
4359 | 3840 gtk_widget_show(gtkconv->sw); |
3841 | |
3842 /* Setup gtkihmtml. */ | |
3843 gtkconv->imhtml = gtk_imhtml_new(NULL, NULL); | |
9005 | 3844 gtk_widget_set_name(gtkconv->imhtml, "gaim_gtkconv_imhtml"); |
4359 | 3845 gtk_container_add(GTK_CONTAINER(gtkconv->sw), gtkconv->imhtml); |
3846 | |
3847 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
3848 gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); |
4359 | 3849 |
3850 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", | |
3851 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
8105 | 3852 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_press_event", |
6057 | 3853 G_CALLBACK(refocus_entry_cb), gtkconv); |
8109 | 3854 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_release_event", |
3855 G_CALLBACK(refocus_entry_cb), gtkconv); | |
4359 | 3856 |
3857 gaim_setup_imhtml(gtkconv->imhtml); | |
3858 gtk_widget_show(gtkconv->imhtml); | |
3859 | |
3860 /* Build the right pane. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3861 lbox = gtk_vbox_new(FALSE, 6); |
4409
0521eec12c33
[gaim-migrate @ 4682]
Christian Hammond <chipx86@chipx86.com>
parents:
4398
diff
changeset
|
3862 gtk_paned_pack2(GTK_PANED(hpaned), lbox, FALSE, TRUE); |
4359 | 3863 gtk_widget_show(lbox); |
3864 | |
3865 /* Setup the label telling how many people are in the room. */ | |
3866 gtkchat->count = gtk_label_new(_("0 people in room")); | |
3867 gtk_box_pack_start(GTK_BOX(lbox), gtkchat->count, FALSE, FALSE, 0); | |
3868 gtk_widget_show(gtkchat->count); | |
3869 | |
3870 /* Setup the list of users. */ | |
7949 | 3871 sw = gtk_scrolled_window_new(NULL, NULL); |
3872 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
8076 | 3873 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
7949 | 3874 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); |
3875 gtk_box_pack_start(GTK_BOX(lbox), sw, TRUE, TRUE, 0); | |
3876 gtk_widget_show(sw); | |
4359 | 3877 |
3878 ls = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING); | |
3879 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), 1, | |
3880 GTK_SORT_ASCENDING); | |
3881 | |
3882 list = gtk_tree_view_new_with_model(GTK_TREE_MODEL(ls)); | |
3883 | |
3884 rend = gtk_cell_renderer_text_new(); | |
3885 col = gtk_tree_view_column_new_with_attributes(NULL, rend, | |
3886 "text", 0, NULL); | |
3887 gtk_tree_view_column_set_clickable(GTK_TREE_VIEW_COLUMN(col), TRUE); | |
3888 | |
3889 g_signal_connect(G_OBJECT(list), "button_press_event", | |
3890 G_CALLBACK(right_click_chat_cb), conv); | |
8143 | 3891 g_signal_connect(G_OBJECT(list), "popup-menu", |
3892 G_CALLBACK(gtkconv_chat_popup_menu_cb), conv); | |
4359 | 3893 |
3894 gtk_tree_view_append_column(GTK_TREE_VIEW(list), col); | |
3895 | |
3896 col = gtk_tree_view_column_new_with_attributes(NULL, rend, | |
3897 "text", 1, NULL); | |
3898 gtk_tree_view_column_set_clickable(GTK_TREE_VIEW_COLUMN(col), TRUE); | |
3899 | |
3900 gtk_tree_view_append_column(GTK_TREE_VIEW(list), col); | |
3901 | |
3902 gtk_widget_set_size_request(list, 150, -1); | |
3903 | |
3904 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(list), FALSE); | |
3905 gtk_widget_show(list); | |
3906 | |
3907 gtkchat->list = list; | |
3908 | |
7949 | 3909 gtk_container_add(GTK_CONTAINER(sw), list); |
4359 | 3910 |
3911 /* Setup the user list toolbar. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3912 bbox = gtk_hbox_new(TRUE, 6); |
4359 | 3913 gtk_box_pack_start(GTK_BOX(lbox), bbox, FALSE, FALSE, 0); |
3914 gtk_widget_show(bbox); | |
3915 | |
3916 /* IM */ | |
3917 button = gaim_pixbuf_button_from_stock(NULL, GTK_STOCK_REDO, | |
3918 GAIM_BUTTON_VERTICAL); | |
3919 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
3920 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
|
3921 gtk_tooltips_set_tip(gtkconv->tooltips, button, _("IM the user"), NULL); |
4359 | 3922 g_signal_connect(G_OBJECT(button), "clicked", |
7961 | 3923 G_CALLBACK(chat_im_button_cb), conv); |
4359 | 3924 |
3925 gtk_widget_show(button); | |
3926 | |
3927 /* Ignore */ | |
3928 button = gaim_pixbuf_button_from_stock(NULL, GAIM_STOCK_IGNORE, | |
3929 GAIM_BUTTON_VERTICAL); | |
3930 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
3931 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
|
3932 gtk_tooltips_set_tip(gtkconv->tooltips, button, |
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3933 _("Ignore the user"), NULL); |
4359 | 3934 g_signal_connect(G_OBJECT(button), "clicked", |
3935 G_CALLBACK(ignore_cb), conv); | |
3936 gtk_widget_show(button); | |
3937 | |
3938 /* Info */ | |
3939 button = gaim_pixbuf_button_from_stock(NULL, GAIM_STOCK_INFO, | |
3940 GAIM_BUTTON_VERTICAL); | |
3941 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
3942 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
3943 gtk_tooltips_set_tip(gtkconv->tooltips, button, | |
4370
d856987c72ca
[gaim-migrate @ 4636]
Christian Hammond <chipx86@chipx86.com>
parents:
4369
diff
changeset
|
3944 _("Get the user's information"), NULL); |
4359 | 3945 g_signal_connect(G_OBJECT(button), "clicked", |
3946 G_CALLBACK(info_cb), conv); | |
3947 | |
3948 gtk_widget_show(button); | |
3949 | |
3950 gtkconv->info = button; | |
3951 | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3952 /* Build the toolbar. */ |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
3953 vbox = gtk_vbox_new(FALSE, 6); |
8914 | 3954 gtk_paned_pack2(GTK_PANED(vpaned), vbox, FALSE, TRUE); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3955 gtk_widget_show(vbox); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3956 |
8317 | 3957 gtkconv->toolbar = gtk_imhtmltoolbar_new(); |
3958 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
|
3959 |
9332 | 3960 gtkconv->lower_hbox = gtk_hbox_new(FALSE, 6); |
3961 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->lower_hbox, TRUE, TRUE, 0); | |
3962 gtk_widget_show(gtkconv->lower_hbox); | |
3963 | |
3964 vbox = gtk_vbox_new(FALSE, 6); | |
3965 gtk_box_pack_end(GTK_BOX(gtkconv->lower_hbox), vbox, TRUE, TRUE, 0); | |
3966 gtk_widget_show(vbox); | |
3967 | |
8123 | 3968 /* Setup the entry widget. |
3969 * We never show the horizontal scrollbar because it was causing weird | |
3970 * lockups when typing text just as you type the character that would | |
3971 * cause both scrollbars to appear. Definitely seems like a gtk bug. | |
3972 */ | |
7949 | 3973 sw = gtk_scrolled_window_new(NULL, NULL); |
3974 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
8112 | 3975 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); |
8061 | 3976 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), |
3977 GTK_SHADOW_IN); | |
9332 | 3978 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); |
7949 | 3979 gtk_widget_show(sw); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3980 |
8061 | 3981 gtkconv->entry = gtk_imhtml_new(NULL, NULL); |
9005 | 3982 gtk_widget_set_name(gtkconv->entry, "gaim_gtkconv_entry"); |
8456 | 3983 gtk_imhtml_smiley_shortcuts(GTK_IMHTML(gtkconv->entry), |
3984 gaim_prefs_get_bool("/gaim/gtk/conversations/smiley_shortcuts")); | |
3985 gtk_imhtml_html_shortcuts(GTK_IMHTML(gtkconv->entry), | |
3986 gaim_prefs_get_bool("/gaim/gtk/conversations/html_shortcuts")); | |
3987 | |
3988 protocol = gaim_find_prpl(conv->account->protocol_id); | |
3989 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), | |
3990 protocol->info->name); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3991 gtkconv->entry_buffer = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3992 gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); |
8061 | 3993 gaim_setup_imhtml(gtkconv->entry); |
3994 gtk_imhtml_set_editable(GTK_IMHTML(gtkconv->entry), TRUE); | |
3995 default_formatize(conv); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3996 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(gtkconv->entry), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
3997 GTK_WRAP_WORD_CHAR); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
3998 gtk_widget_set_size_request(gtkconv->entry, -1, |
8106 | 3999 gaim_prefs_get_int("/gaim/gtk/conversations/chat/entry_height")); |
7949 | 4000 g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", conv); |
4001 | |
4002 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", | |
8105 | 4003 G_CALLBACK(entry_key_press_cb), conv); |
4359 | 4004 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", |
4005 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
8914 | 4006 g_signal_connect(G_OBJECT(gtkconv->entry), "size-allocate", |
4007 G_CALLBACK(size_allocate_cb), conv); | |
4359 | 4008 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4009 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
4010 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4011 gtk_imhtmltoolbar_attach(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4012 gtkconv->entry); |
4359 | 4013 |
7949 | 4014 gtk_container_add(GTK_CONTAINER(sw), GTK_WIDGET(gtkconv->entry)); |
4359 | 4015 gtk_widget_show(gtkconv->entry); |
4016 | |
4017 /* Setup the bottom button box. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4018 gtkconv->bbox = gtk_hbox_new(FALSE, 6); |
4359 | 4019 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->bbox, FALSE, FALSE, 0); |
4020 gtk_widget_show(gtkconv->bbox); | |
4021 | |
4022 setup_chat_buttons(conv, gtkconv->bbox); | |
4023 | |
9080 | 4024 /* |
4025 * Focus for chat windows should be as follows: | |
4026 * Tab title -> chat topic -> conversation scrollback -> user list -> | |
4027 * user list buttons -> entry -> buttons at bottom | |
4028 */ | |
4029 focus_chain = g_list_prepend(focus_chain, gtkconv->bbox); | |
9332 | 4030 focus_chain = g_list_prepend(focus_chain, gtkconv->entry); |
9080 | 4031 gtk_container_set_focus_chain(GTK_CONTAINER(vbox), focus_chain); |
4032 | |
4359 | 4033 return vpaned; |
4034 } | |
4035 | |
4036 static GtkWidget * | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4037 setup_im_pane(GaimConversation *conv) |
4359 | 4038 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4039 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4040 GaimGtkImPane *gtkim; |
8456 | 4041 GaimPlugin *protocol; |
4359 | 4042 GtkWidget *paned; |
4043 GtkWidget *vbox; | |
4044 GtkWidget *vbox2; | |
7949 | 4045 GtkWidget *sw; |
9080 | 4046 GList *focus_chain = NULL; |
4359 | 4047 |
4048 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4049 gtkim = gtkconv->u.im; | |
4050 | |
4051 /* Setup the outer pane. */ | |
4052 paned = gtk_vpaned_new(); | |
4053 gtk_widget_show(paned); | |
4054 | |
4055 /* Setup the top part of the pane. */ | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4056 vbox = gtk_vbox_new(FALSE, 6); |
4409
0521eec12c33
[gaim-migrate @ 4682]
Christian Hammond <chipx86@chipx86.com>
parents:
4398
diff
changeset
|
4057 gtk_paned_pack1(GTK_PANED(paned), vbox, TRUE, TRUE); |
4359 | 4058 gtk_widget_show(vbox); |
4059 | |
4060 /* Setup the gtkimhtml widget. */ | |
4061 gtkconv->sw = gtk_scrolled_window_new(NULL, NULL); | |
4062 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(gtkconv->sw), | |
8076 | 4063 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
4359 | 4064 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(gtkconv->sw), |
4065 GTK_SHADOW_IN); | |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4066 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->sw, TRUE, TRUE, 0); |
4851 | 4067 |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
4068 gtk_widget_set_size_request(gtkconv->sw, |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
4069 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_width"), |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
4070 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_height")); |
8914 | 4071 g_signal_connect(G_OBJECT(gtkconv->sw), "size-allocate", |
4072 G_CALLBACK(size_allocate_cb), conv); | |
4359 | 4073 gtk_widget_show(gtkconv->sw); |
4074 | |
4075 gtkconv->imhtml = gtk_imhtml_new(NULL, NULL); | |
9005 | 4076 gtk_widget_set_name(gtkconv->imhtml, "gaim_gtkconv_imhtml"); |
4359 | 4077 gtk_container_add(GTK_CONTAINER(gtkconv->sw), gtkconv->imhtml); |
4078 | |
4079 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", | |
4080 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
8105 | 4081 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_press_event", |
6057 | 4082 G_CALLBACK(refocus_entry_cb), gtkconv); |
8109 | 4083 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_release_event", |
4084 G_CALLBACK(refocus_entry_cb), gtkconv); | |
4359 | 4085 |
4086 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4087 gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); |
4359 | 4088 gaim_setup_imhtml(gtkconv->imhtml); |
4089 gtk_widget_show(gtkconv->imhtml); | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4090 vbox2 = gtk_vbox_new(FALSE, 6); |
8914 | 4091 gtk_paned_pack2(GTK_PANED(paned), vbox2, FALSE, TRUE); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4092 gtk_widget_show(vbox2); |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4093 |
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4094 /* Build the toolbar. */ |
8317 | 4095 gtkconv->toolbar = gtk_imhtmltoolbar_new(); |
4096 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
|
4097 |
8123 | 4098 /* Setup the entry widget. |
4099 * 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
|
4100 * lockups when typing text just as you type the character that would |
8123 | 4101 * cause both scrollbars to appear. Definitely seems like a gtk bug. |
4102 */ | |
9332 | 4103 gtkconv->lower_hbox = gtk_hbox_new(FALSE, 6); |
4104 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->lower_hbox, TRUE, TRUE, 0); | |
4105 gtk_widget_show(gtkconv->lower_hbox); | |
4106 | |
4107 vbox2 = gtk_vbox_new(FALSE, 6); | |
4108 gtk_box_pack_end(GTK_BOX(gtkconv->lower_hbox), vbox2, TRUE, TRUE, 0); | |
4109 gtk_widget_show(vbox2); | |
8821 | 4110 |
7949 | 4111 sw = gtk_scrolled_window_new(NULL, NULL); |
4112 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
8112 | 4113 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); |
8061 | 4114 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), |
4115 GTK_SHADOW_IN); | |
9332 | 4116 gtk_box_pack_start(GTK_BOX(vbox2), sw, TRUE, TRUE, 0); |
7949 | 4117 gtk_widget_show(sw); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4118 |
8061 | 4119 gtkconv->entry = gtk_imhtml_new(NULL, NULL); |
9005 | 4120 gtk_widget_set_name(gtkconv->entry, "gaim_gtkconv_entry"); |
8456 | 4121 |
4122 gtk_imhtml_smiley_shortcuts(GTK_IMHTML(gtkconv->entry), | |
4123 gaim_prefs_get_bool("/gaim/gtk/conversations/smiley_shortcuts")); | |
4124 gtk_imhtml_html_shortcuts(GTK_IMHTML(gtkconv->entry), | |
4125 gaim_prefs_get_bool("/gaim/gtk/conversations/html_shortcuts")); | |
4126 | |
4127 protocol = gaim_find_prpl(conv->account->protocol_id); | |
4128 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), | |
4129 protocol->info->name); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4130 gtkconv->entry_buffer = |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4131 gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); |
8061 | 4132 gaim_setup_imhtml(gtkconv->entry); |
4133 gtk_imhtml_set_editable(GTK_IMHTML(gtkconv->entry), TRUE); | |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4134 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(gtkconv->entry), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4135 GTK_WRAP_WORD_CHAR); |
4963
7f5e7f2ef317
[gaim-migrate @ 5297]
Christian Hammond <chipx86@chipx86.com>
parents:
4958
diff
changeset
|
4136 gtk_widget_set_size_request(gtkconv->entry, -1, |
8106 | 4137 gaim_prefs_get_int("/gaim/gtk/conversations/im/entry_height")); |
7949 | 4138 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
|
4139 |
4359 | 4140 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", |
8105 | 4141 G_CALLBACK(entry_key_press_cb), conv); |
4359 | 4142 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", |
4143 G_CALLBACK(entry_stop_rclick_cb), NULL); | |
8914 | 4144 g_signal_connect(G_OBJECT(gtkconv->entry), "size-allocate", |
4145 G_CALLBACK(size_allocate_cb), conv); | |
4359 | 4146 |
4147 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "insert_text", | |
4148 G_CALLBACK(insert_text_cb), conv); | |
4149 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "delete_range", | |
4150 G_CALLBACK(delete_text_cb), conv); | |
4151 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4152 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
4153 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
4359 | 4154 |
7949 | 4155 gtk_container_add(GTK_CONTAINER(sw), GTK_WIDGET(gtkconv->entry)); |
4359 | 4156 gtk_widget_show(gtkconv->entry); |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
4157 gtk_imhtmltoolbar_attach(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), |
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
4158 gtkconv->entry); |
8481 | 4159 /* had to move this after the imtoolbar is attached so that the |
4160 * signals get fired to toggle the buttons on the toolbar as well. | |
4161 */ | |
4162 default_formatize(conv); | |
4359 | 4163 |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4164 gtkconv->bbox = gtk_hbox_new(FALSE, 6); |
4359 | 4165 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->bbox, FALSE, FALSE, 0); |
4166 gtk_widget_show(gtkconv->bbox); | |
4167 | |
4168 setup_im_buttons(conv, gtkconv->bbox); | |
8758 | 4169 gtkconv->u.im->animate = gaim_prefs_get_bool("/gaim/gtk/conversations/im/animate_buddy_icons"); |
4359 | 4170 |
9080 | 4171 /* |
4172 * Focus for IM windows should be as follows: | |
4173 * Tab title -> conversation scrollback -> entry -> buttons at bottom | |
4174 */ | |
4175 focus_chain = g_list_prepend(focus_chain, gtkconv->bbox); | |
9332 | 4176 focus_chain = g_list_prepend(focus_chain, gtkconv->entry); |
9080 | 4177 gtk_container_set_focus_chain(GTK_CONTAINER(vbox2), focus_chain); |
8143 | 4178 |
4359 | 4179 return paned; |
4180 } | |
4181 | |
4182 static void | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4183 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
|
4184 GtkSelectionData *sd, guint info, guint t, |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4185 GaimConversation *conv) |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4186 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4187 GaimConvWindow *win = conv->window; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4188 GaimConversation *c; |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4189 if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE)) |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4190 { |
4781 | 4191 GaimBlistNode *n = NULL; |
6695 | 4192 GaimBuddy *b; |
4781 | 4193 memcpy(&n, sd->data, sizeof(n)); |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
4194 |
6695 | 4195 if (GAIM_BLIST_NODE_IS_CONTACT(n)) |
4196 b = gaim_contact_get_priority_buddy((GaimContact*)n); | |
4197 else if (GAIM_BLIST_NODE_IS_BUDDY(n)) | |
4198 b = (GaimBuddy*)n; | |
4199 else | |
4781 | 4200 return; |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
4201 |
7089
2cd3756a637b
[gaim-migrate @ 7654]
Christian Hammond <chipx86@chipx86.com>
parents:
7078
diff
changeset
|
4202 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
|
4203 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4204 gaim_conv_window_add_conversation(win, c); |
8802
1076cd8579ea
[gaim-migrate @ 9564]
Christian Hammond <chipx86@chipx86.com>
parents:
8758
diff
changeset
|
4205 |
1076cd8579ea
[gaim-migrate @ 9564]
Christian Hammond <chipx86@chipx86.com>
parents:
8758
diff
changeset
|
4206 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); |
4702 | 4207 } |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4208 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
|
4209 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4210 char *protocol = NULL; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4211 char *username = NULL; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4212 GaimAccount *account; |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4213 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4214 if (gaim_gtk_parse_x_im_contact(sd->data, FALSE, &account, |
7718 | 4215 &protocol, &username, NULL)) |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4216 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4217 if (account == NULL) |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4218 { |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4219 gaim_notify_error(NULL, NULL, |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4220 _("You are not currently signed on with an account that " |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4221 "can add that buddy."), NULL); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4222 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4223 else |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4224 { |
7718 | 4225 c = gaim_conversation_new(GAIM_CONV_IM, account, username); |
4226 gaim_conv_window_add_conversation(win, c); | |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4227 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4228 } |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4229 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4230 if (username != NULL) g_free(username); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4231 if (protocol != NULL) g_free(protocol); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4232 |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4233 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4234 } |
9300 | 4235 gtk_drag_finish(dc, FALSE, FALSE, t); |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4236 } |
4359 | 4237 |
4238 /************************************************************************** | |
4239 * GTK+ window ops | |
4240 **************************************************************************/ | |
4241 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4242 gaim_gtk_new_window(GaimConvWindow *win) |
4359 | 4243 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4244 GaimGtkWindow *gtkwin; |
4359 | 4245 GtkPositionType pos; |
4246 GtkWidget *testidea; | |
4247 GtkWidget *menubar; | |
4248 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4249 gtkwin = g_malloc0(sizeof(GaimGtkWindow)); |
4359 | 4250 |
4251 win->ui_data = gtkwin; | |
4252 | |
4253 /* Create the window. */ | |
4254 gtkwin->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
4255 gtk_window_set_role(GTK_WINDOW(gtkwin->window), "conversation"); | |
4635 | 4256 gtk_window_set_resizable(GTK_WINDOW(gtkwin->window), TRUE); |
4510
4c394222c732
[gaim-migrate @ 4786]
Christian Hammond <chipx86@chipx86.com>
parents:
4505
diff
changeset
|
4257 gtk_container_set_border_width(GTK_CONTAINER(gtkwin->window), 0); |
5173 | 4258 GTK_WINDOW(gtkwin->window)->allow_shrink = TRUE; |
4359 | 4259 gtk_widget_realize(gtkwin->window); |
4260 | |
4261 g_signal_connect(G_OBJECT(gtkwin->window), "delete_event", | |
4262 G_CALLBACK(close_win_cb), win); | |
4263 | |
4264 /* Create the notebook. */ | |
4265 gtkwin->notebook = gtk_notebook_new(); | |
4266 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4267 pos = gaim_prefs_get_int("/gaim/gtk/conversations/tab_side"); |
4359 | 4268 |
4269 #if 0 | |
4270 gtk_notebook_set_tab_hborder(GTK_NOTEBOOK(gtkwin->notebook), 0); | |
4271 gtk_notebook_set_tab_vborder(GTK_NOTEBOOK(gtkwin->notebook), 0); | |
4272 #endif | |
4273 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos); | |
4274 gtk_notebook_set_scrollable(GTK_NOTEBOOK(gtkwin->notebook), TRUE); | |
4275 gtk_notebook_popup_enable(GTK_NOTEBOOK(gtkwin->notebook)); | |
4818 | 4276 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), FALSE); |
4277 | |
4359 | 4278 gtk_widget_show(gtkwin->notebook); |
4279 | |
8189 | 4280 g_signal_connect(G_OBJECT(gtkwin->notebook), "switch_page", |
4281 G_CALLBACK(before_switch_conv_cb), win); | |
4359 | 4282 g_signal_connect_after(G_OBJECT(gtkwin->notebook), "switch_page", |
4283 G_CALLBACK(switch_conv_cb), win); | |
4284 | |
4285 /* Setup the tab drag and drop signals. */ | |
4486 | 4286 gtk_widget_add_events(gtkwin->notebook, |
4287 GDK_BUTTON1_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK); | |
4288 g_signal_connect(G_OBJECT(gtkwin->notebook), "button_press_event", | |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4289 G_CALLBACK(notebook_press_cb), win); |
4486 | 4290 g_signal_connect(G_OBJECT(gtkwin->notebook), "button_release_event", |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4291 G_CALLBACK(notebook_release_cb), win); |
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4292 |
4359 | 4293 testidea = gtk_vbox_new(FALSE, 0); |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4294 |
4359 | 4295 /* Setup the menubar. */ |
4296 menubar = setup_menubar(win); | |
4297 gtk_box_pack_start(GTK_BOX(testidea), menubar, FALSE, TRUE, 0); | |
4298 | |
4299 gtk_box_pack_start(GTK_BOX(testidea), gtkwin->notebook, TRUE, TRUE, 0); | |
4300 | |
4301 gtk_container_add(GTK_CONTAINER(gtkwin->window), testidea); | |
4302 | |
4303 gtk_widget_show(testidea); | |
4304 } | |
4305 | |
4306 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4307 gaim_gtk_destroy_window(GaimConvWindow *win) |
4359 | 4308 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4309 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4310 |
4311 gtk_widget_destroy(gtkwin->window); | |
4312 | |
4630 | 4313 g_object_unref(G_OBJECT(gtkwin->menu.item_factory)); |
4314 | |
4359 | 4315 g_free(gtkwin); |
4316 win->ui_data = NULL; | |
4317 } | |
4318 | |
4319 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4320 gaim_gtk_show(GaimConvWindow *win) |
4359 | 4321 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4322 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4323 |
4324 gtk_widget_show(gtkwin->window); | |
7413 | 4325 |
4326 #ifdef _WIN32 | |
7415 | 4327 /* This works around a win32 gtk+ bug, where it can't handle |
4328 * creating the button correctly before the window is shown. | |
4329 * That's why we get the appearance of a button, without all | |
4330 * the normal button-like properties, like being able to click | |
7413 | 4331 * it. ;-) --Nathan */ |
7414 | 4332 if (gaim_prefs_get_bool("/gaim/gtk/conversations/close_on_tabs")) { |
4333 GaimConversation *conv; | |
4334 GaimGtkConversation *gtkconv; | |
4335 | |
4336 conv = gaim_conv_window_get_conversation_at(win, 0); | |
4337 if(conv) { | |
4338 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
7415 | 4339 gtk_widget_hide(gtkconv->close); |
7414 | 4340 gtk_widget_show_all(gtkconv->close); |
4341 } | |
4342 } | |
7413 | 4343 #endif |
4359 | 4344 } |
4345 | |
4346 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4347 gaim_gtk_hide(GaimConvWindow *win) |
4359 | 4348 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4349 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4350 |
4351 gtk_widget_hide(gtkwin->window); | |
4352 } | |
4353 | |
4354 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4355 gaim_gtk_raise(GaimConvWindow *win) |
4359 | 4356 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4357 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4358 |
5484 | 4359 gtk_widget_show(gtkwin->window); |
5103 | 4360 gtk_window_deiconify(GTK_WINDOW(gtkwin->window)); |
4526 | 4361 gdk_window_raise(gtkwin->window->window); |
4359 | 4362 } |
4363 | |
4364 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4365 gaim_gtk_flash(GaimConvWindow *win) |
4359 | 4366 { |
4367 #ifdef _WIN32 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4368 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4369 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4370 wgaim_conv_im_blink(gtkwin->window); |
4359 | 4371 #endif |
4372 } | |
4373 | |
4374 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4375 gaim_gtk_switch_conversation(GaimConvWindow *win, unsigned int index) |
4359 | 4376 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4377 GaimGtkWindow *gtkwin; |
4359 | 4378 |
4379 gtkwin = GAIM_GTK_WINDOW(win); | |
4380 | |
4381 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), index); | |
4382 } | |
4383 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4384 static const GtkTargetEntry te[] = |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4385 { |
7695 | 4386 {"text/plain", 0, 0}, |
4387 {"text/uri-list", 0, 1}, | |
7712
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4388 {"GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, 2}, |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4389 {"STRING", 0, 3}, |
2823111061ba
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7700
diff
changeset
|
4390 {"application/x-im-contact", 0, 4} |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4391 }; |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4392 |
4359 | 4393 static void |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4394 gaim_gtk_add_conversation(GaimConvWindow *win, GaimConversation *conv) |
4359 | 4395 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4396 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4397 GaimGtkConversation *gtkconv, *focus_gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4398 GaimConversation *focus_conv; |
4359 | 4399 GtkWidget *pane = NULL; |
4400 GtkWidget *tab_cont; | |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4401 GtkWidget *tabby, *menu_tabby; |
4359 | 4402 gboolean new_ui; |
4383
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4403 GaimConversationType conv_type; |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4404 const char *name; |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4405 |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4406 name = gaim_conversation_get_name(conv); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4407 conv_type = gaim_conversation_get_type(conv); |
f7a84034f97f
[gaim-migrate @ 4649]
Christian Hammond <chipx86@chipx86.com>
parents:
4382
diff
changeset
|
4408 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 4409 |
4410 if (conv->ui_data != NULL) { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4411 gtkconv = (GaimGtkConversation *)conv->ui_data; |
4359 | 4412 |
4413 tab_cont = gtkconv->tab_cont; | |
4414 | |
4415 new_ui = FALSE; | |
4416 } | |
4417 else { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4418 gtkconv = g_malloc0(sizeof(GaimGtkConversation)); |
4359 | 4419 conv->ui_data = gtkconv; |
4420 | |
4421 /* Setup some initial variables. */ | |
4422 gtkconv->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
4423 gtkconv->tooltips = gtk_tooltips_new(); | |
4424 | |
7879 | 4425 if (conv_type == GAIM_CONV_IM) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4426 gtkconv->u.im = g_malloc0(sizeof(GaimGtkImPane)); |
4359 | 4427 gtkconv->u.im->a_virgin = TRUE; |
4428 | |
4429 pane = setup_im_pane(conv); | |
4430 } | |
7879 | 4431 else if (conv_type == GAIM_CONV_CHAT) { |
4432 gtkconv->u.chat = g_malloc0(sizeof(GaimGtkChatPane)); | |
4433 | |
4434 pane = setup_chat_pane(conv); | |
4435 } | |
4359 | 4436 |
4437 if (pane == NULL) { | |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4438 if (conv_type == GAIM_CONV_CHAT) g_free(gtkconv->u.chat); |
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4439 else if (conv_type == GAIM_CONV_IM) g_free(gtkconv->u.im); |
4359 | 4440 |
4441 g_free(gtkconv); | |
4442 conv->ui_data = NULL; | |
4443 | |
4444 return; | |
4445 } | |
4446 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4447 /* Setup drag-and-drop */ |
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4448 gtk_drag_dest_set(pane, |
9300 | 4449 GTK_DEST_DEFAULT_MOTION | |
4450 GTK_DEST_DEFAULT_DROP, | |
4451 te, sizeof(te) / sizeof(GtkTargetEntry), | |
4452 GDK_ACTION_COPY); | |
4453 gtk_drag_dest_set(pane, | |
4454 GTK_DEST_DEFAULT_MOTION | | |
4455 GTK_DEST_DEFAULT_DROP, | |
4456 te, sizeof(te) / sizeof(GtkTargetEntry), | |
4457 GDK_ACTION_COPY); | |
4458 gtk_drag_dest_set(gtkconv->imhtml, 0, | |
4459 te, sizeof(te) / sizeof(GtkTargetEntry), | |
4460 GDK_ACTION_COPY); | |
4461 | |
4462 gtk_drag_dest_set(gtkconv->entry, 0, | |
4463 te, sizeof(te) / sizeof(GtkTargetEntry), | |
4464 GDK_ACTION_COPY); | |
4465 | |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4466 g_signal_connect(G_OBJECT(pane), "drag_data_received", |
9300 | 4467 G_CALLBACK(conv_dnd_recv), conv); |
4689
69b19e132df0
[gaim-migrate @ 5000]
Christian Hammond <chipx86@chipx86.com>
parents:
4687
diff
changeset
|
4468 g_signal_connect(G_OBJECT(gtkconv->imhtml), "drag_data_received", |
9300 | 4469 G_CALLBACK(conv_dnd_recv), conv); |
8105 | 4470 g_signal_connect(G_OBJECT(gtkconv->entry), "drag_data_received", |
9300 | 4471 G_CALLBACK(conv_dnd_recv), conv); |
4472 | |
4359 | 4473 /* Setup the container for the tab. */ |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4474 gtkconv->tab_cont = tab_cont = gtk_vbox_new(FALSE, 6); |
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4475 gtk_container_set_border_width(GTK_CONTAINER(tab_cont), 6); |
4359 | 4476 gtk_container_add(GTK_CONTAINER(tab_cont), pane); |
4477 gtk_widget_show(pane); | |
4478 | |
4479 new_ui = TRUE; | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
4480 |
4359 | 4481 gtkconv->make_sound = TRUE; |
5902
6889b89cab90
[gaim-migrate @ 6334]
Christian Hammond <chipx86@chipx86.com>
parents:
5901
diff
changeset
|
4482 |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4483 gtkconv->show_formatting_toolbar = gaim_prefs_get_bool( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4484 "/gaim/gtk/conversations/show_formatting_toolbar"); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4485 |
8329
9dd7c75ed433
[gaim-migrate @ 9053]
Christian Hammond <chipx86@chipx86.com>
parents:
8319
diff
changeset
|
4486 if (gtkconv->show_formatting_toolbar) |
9dd7c75ed433
[gaim-migrate @ 9053]
Christian Hammond <chipx86@chipx86.com>
parents:
8319
diff
changeset
|
4487 gtk_widget_show(gtkconv->toolbar); |
9dd7c75ed433
[gaim-migrate @ 9053]
Christian Hammond <chipx86@chipx86.com>
parents:
8319
diff
changeset
|
4488 |
9188 | 4489 gtkconv->show_timestamps = gaim_prefs_get_bool( |
4490 "/gaim/gtk/conversations/show_timestamps"); | |
4491 | |
4492 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | |
4493 gtkconv->show_timestamps); | |
4494 | |
8176 | 4495 g_signal_connect_swapped(G_OBJECT(pane), "focus", |
9080 | 4496 G_CALLBACK(gtk_widget_grab_focus), |
4497 gtkconv->entry); | |
4359 | 4498 } |
4499 | |
8253
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4500 gtkconv->tabby = tabby = gtk_hbox_new(FALSE, 6); |
0c5977fd3101
[gaim-migrate @ 8976]
Christian Hammond <chipx86@chipx86.com>
parents:
8252
diff
changeset
|
4501 gtkconv->menu_tabby = menu_tabby = gtk_hbox_new(FALSE, 6); |
4359 | 4502 |
4503 /* Close button. */ | |
4504 gtkconv->close = gtk_button_new(); | |
4505 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
|
4506 gtk_button_set_relief(GTK_BUTTON(gtkconv->close), GTK_RELIEF_NONE); |
4359 | 4507 gtk_container_add(GTK_CONTAINER(gtkconv->close), |
4445 | 4508 gtk_image_new_from_stock(GTK_STOCK_CLOSE, |
4509 GTK_ICON_SIZE_MENU)); | |
4359 | 4510 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->close, |
4572
06084165a966
[gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents:
4571
diff
changeset
|
4511 _("Close conversation"), NULL); |
4359 | 4512 |
4513 g_signal_connect(G_OBJECT(gtkconv->close), "clicked", | |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4514 G_CALLBACK(close_conv_cb), conv); |
4359 | 4515 |
7446
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4516 /* |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4517 * 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
|
4518 * border bug. I love you guys! -- ChipX86 |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4519 */ |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4520 g_signal_connect(G_OBJECT(gtkconv->close), "state_changed", |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4521 G_CALLBACK(tab_close_button_state_changed_cb), NULL); |
064c697cc223
[gaim-migrate @ 8057]
Christian Hammond <chipx86@chipx86.com>
parents:
7440
diff
changeset
|
4522 |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4523 /* Status icon. */ |
6440 | 4524 gtkconv->icon = gtk_image_new(); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4525 gtkconv->menu_icon = gtk_image_new(); |
6440 | 4526 update_tab_icon(conv); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4527 |
4359 | 4528 /* Tab label. */ |
4529 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
|
4530 gtkconv->menu_label = gtk_label_new(gaim_conversation_get_title(conv)); |
4359 | 4531 #if 0 |
4532 gtk_misc_set_alignment(GTK_MISC(gtkconv->tab_label), 0.00, 0.5); | |
4533 gtk_misc_set_padding(GTK_MISC(gtkconv->tab_label), 4, 0); | |
4534 #endif | |
4535 | |
4939
4d50e125b0fa
[gaim-migrate @ 5273]
Christian Hammond <chipx86@chipx86.com>
parents:
4931
diff
changeset
|
4536 |
4359 | 4537 /* Pack it all together. */ |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4538 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
|
4539 gtk_box_pack_start(GTK_BOX(menu_tabby), gtkconv->menu_icon, |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4540 FALSE, FALSE, 0); |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4541 |
8946 | 4542 gtk_widget_show_all(gtkconv->icon); |
4543 gtk_widget_show_all(gtkconv->menu_icon); | |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
4544 |
4359 | 4545 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
|
4546 gtk_box_pack_start(GTK_BOX(menu_tabby), gtkconv->menu_label, TRUE, TRUE, 0); |
4445 | 4547 gtk_widget_show(gtkconv->tab_label); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4548 gtk_widget_show(gtkconv->menu_label); |
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4549 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
|
4550 |
4445 | 4551 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
|
4552 if (gaim_prefs_get_bool("/gaim/gtk/conversations/close_on_tabs")) |
4445 | 4553 gtk_widget_show_all(gtkconv->close); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4554 |
4445 | 4555 gtk_widget_show(tabby); |
6771
8eebba08b44b
[gaim-migrate @ 7308]
Christian Hammond <chipx86@chipx86.com>
parents:
6760
diff
changeset
|
4556 gtk_widget_show(menu_tabby); |
4359 | 4557 |
7143 | 4558 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
4559 gaim_gtkconv_update_buddy_icon(conv); | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
4560 |
9297 | 4561 /* Add this pane to the conversation's notebook. */ |
4359 | 4562 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
|
4563 gtk_notebook_set_menu_label(GTK_NOTEBOOK(gtkwin->notebook), |
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
4564 tab_cont, menu_tabby); |
4359 | 4565 |
4566 gtk_widget_show(tab_cont); | |
4567 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4568 if (gaim_conv_window_get_conversation_count(win) == 1) { |
4818 | 4569 /* Er, bug in notebooks? Switch to the page manually. */ |
4359 | 4570 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), 0); |
4851 | 4571 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4572 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4573 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4574 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4575 else |
4818 | 4576 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), TRUE); |
4359 | 4577 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4578 focus_conv = g_list_nth_data(gaim_conv_window_get_conversations(win), |
5204 | 4579 gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook))); |
4580 focus_gtkconv = GAIM_GTK_CONVERSATION(focus_conv); | |
4581 gtk_widget_grab_focus(focus_gtkconv->entry); | |
4359 | 4582 |
4583 if (!new_ui) | |
4584 g_object_unref(gtkconv->tab_cont); | |
4585 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4586 if (gaim_conv_window_get_conversation_count(win) == 1) |
4685 | 4587 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); |
4359 | 4588 } |
4589 | |
4590 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4591 gaim_gtk_remove_conversation(GaimConvWindow *win, GaimConversation *conv) |
4359 | 4592 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4593 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4594 GaimGtkConversation *gtkconv; |
4359 | 4595 unsigned int index; |
4818 | 4596 GaimConversationType conv_type; |
4597 | |
4598 conv_type = gaim_conversation_get_type(conv); | |
4359 | 4599 index = gaim_conversation_get_index(conv); |
4600 | |
4601 gtkwin = GAIM_GTK_WINDOW(win); | |
4602 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4603 | |
4604 g_object_ref(gtkconv->tab_cont); | |
4605 gtk_object_sink(GTK_OBJECT(gtkconv->tab_cont)); | |
4606 | |
4607 gtk_notebook_remove_page(GTK_NOTEBOOK(gtkwin->notebook), index); | |
4608 | |
4818 | 4609 /* go back to tabless if need be */ |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4610 if (gaim_conv_window_get_conversation_count(win) <= 2) { |
4818 | 4611 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4612 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); |
4818 | 4613 } |
4614 | |
4615 | |
4359 | 4616 /* If this window is setup with an inactive gc, regenerate the menu. */ |
4818 | 4617 if (conv_type == GAIM_CONV_IM && |
4359 | 4618 gaim_conversation_get_gc(conv) == NULL) { |
4619 | |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
4620 generate_send_as_items(win, conv); |
4359 | 4621 } |
4622 } | |
4623 | |
4624 static void | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4625 gaim_gtk_move_conversation(GaimConvWindow *win, GaimConversation *conv, |
4359 | 4626 unsigned int new_index) |
4627 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4628 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4629 GaimGtkConversation *gtkconv; |
4359 | 4630 |
4631 gtkwin = GAIM_GTK_WINDOW(win); | |
4632 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
4633 | |
4415
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4634 if (new_index > gaim_conversation_get_index(conv)) |
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4635 new_index--; |
c90039137172
[gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents:
4409
diff
changeset
|
4636 |
4359 | 4637 gtk_notebook_reorder_child(GTK_NOTEBOOK(gtkwin->notebook), |
4638 gtkconv->tab_cont, new_index); | |
4639 } | |
4640 | |
4641 static int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4642 gaim_gtk_get_active_index(const GaimConvWindow *win) |
4359 | 4643 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4644 GaimGtkWindow *gtkwin; |
5680
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4645 int index; |
4359 | 4646 |
4647 gtkwin = GAIM_GTK_WINDOW(win); | |
4648 | |
5680
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4649 index = gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook)); |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4650 |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4651 /* |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4652 * A fix, because the first conversation may be active, but not |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4653 * appear in the notebook just yet. -- ChipX86 |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4654 */ |
71cc0d5376c2
[gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents:
5678
diff
changeset
|
4655 return (index == -1 ? 0 : index); |
4359 | 4656 } |
4657 | |
9260
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4658 static gboolean |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4659 gaim_gtk_has_focus(GaimConvWindow *win) |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4660 { |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4661 GaimGtkWindow *gtkwin; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4662 gboolean has_focus = FALSE; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4663 |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4664 gtkwin = GAIM_GTK_WINDOW(win); |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4665 g_object_get(G_OBJECT(gtkwin->window), "has-toplevel-focus", &has_focus, NULL); |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4666 |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4667 return has_focus; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4668 } |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4669 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4670 static GaimConvWindowUiOps window_ui_ops = |
4359 | 4671 { |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
4672 gaim_gtk_conversations_get_conv_ui_ops, |
4359 | 4673 gaim_gtk_new_window, |
4674 gaim_gtk_destroy_window, | |
4675 gaim_gtk_show, | |
4676 gaim_gtk_hide, | |
4677 gaim_gtk_raise, | |
4678 gaim_gtk_flash, | |
4679 gaim_gtk_switch_conversation, | |
4680 gaim_gtk_add_conversation, | |
4681 gaim_gtk_remove_conversation, | |
4682 gaim_gtk_move_conversation, | |
9260
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4683 gaim_gtk_get_active_index, |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
4684 gaim_gtk_has_focus |
4359 | 4685 }; |
4686 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4687 GaimConvWindowUiOps * |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
4688 gaim_gtk_conversations_get_win_ui_ops(void) |
4359 | 4689 { |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4690 return &window_ui_ops; |
4359 | 4691 } |
4692 | |
4693 /************************************************************************** | |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
4694 * Conversation UI operations |
4359 | 4695 **************************************************************************/ |
4696 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4697 gaim_gtkconv_destroy(GaimConversation *conv) |
4359 | 4698 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4699 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); |
4359 | 4700 |
4701 if (gtkconv->dialogs.log != NULL) | |
4702 gtk_widget_destroy(gtkconv->dialogs.log); | |
4703 | |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4704 gtk_widget_destroy(gtkconv->tab_cont); |
4892 | 4705 g_object_unref(gtkconv->tab_cont); |
4571
51e988d015ed
[gaim-migrate @ 4852]
Christian Hammond <chipx86@chipx86.com>
parents:
4561
diff
changeset
|
4706 |
4359 | 4707 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
4755 | 4708 if (gtkconv->u.im->icon_timer != 0) |
4709 g_source_remove(gtkconv->u.im->icon_timer); | |
4710 | |
4359 | 4711 if (gtkconv->u.im->save_icon != NULL) |
4712 gtk_widget_destroy(gtkconv->u.im->save_icon); | |
4713 | |
4714 if (gtkconv->u.im->anim != NULL) | |
4793 | 4715 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); |
4359 | 4716 |
4717 g_free(gtkconv->u.im); | |
4718 } | |
4719 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
4720 g_free(gtkconv->u.chat); | |
4721 } | |
4722 | |
4633 | 4723 gtk_object_sink(GTK_OBJECT(gtkconv->tooltips)); |
4724 | |
4359 | 4725 g_free(gtkconv); |
4726 } | |
4727 | |
4728 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4729 gaim_gtkconv_write_im(GaimConversation *conv, const char *who, |
6982 | 4730 const char *message, GaimMessageFlags flags, |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4731 time_t mtime) |
4359 | 4732 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4733 GaimGtkConversation *gtkconv; |
8630 | 4734 GaimConvWindow *gaimwin; |
4735 GaimGtkWindow *gtkwin; | |
4736 gboolean has_focus; | |
4359 | 4737 |
4738 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
8630 | 4739 gaimwin = gaim_conversation_get_window(conv); |
4740 gtkwin = GAIM_GTK_WINDOW(gaimwin); | |
4741 | |
4742 g_object_get(G_OBJECT(gtkwin->window), "has-toplevel-focus", &has_focus, NULL); | |
4359 | 4743 |
6621 | 4744 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
9301 | 4745 gaim_prefs_get_bool("/gaim/gtk/conversations/im/raise_on_events")) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4746 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4747 gaim_conv_window_raise(gaim_conversation_get_window(conv)); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4748 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4749 |
4382
76223649765b
[gaim-migrate @ 4648]
Christian Hammond <chipx86@chipx86.com>
parents:
4378
diff
changeset
|
4750 /* Play a sound, if specified in prefs. */ |
8630 | 4751 if (gtkconv->make_sound && !((gaim_conv_window_get_active_conversation(gaimwin) == conv) && |
8633 | 4752 !gaim_prefs_get_bool("/gaim/gtk/sound/conv_focus") && has_focus)) { |
6621 | 4753 if (flags & GAIM_MESSAGE_RECV) { |
4359 | 4754 if (gtkconv->u.im->a_virgin && |
5820 | 4755 gaim_prefs_get_bool("/gaim/gtk/sound/enabled/first_im_recv")) { |
4359 | 4756 |
4561 | 4757 gaim_sound_play_event(GAIM_SOUND_FIRST_RECEIVE); |
4359 | 4758 } |
4759 else | |
4561 | 4760 gaim_sound_play_event(GAIM_SOUND_RECEIVE); |
4359 | 4761 } |
4762 else { | |
4561 | 4763 gaim_sound_play_event(GAIM_SOUND_SEND); |
4359 | 4764 } |
4765 } | |
4766 | |
4767 gtkconv->u.im->a_virgin = FALSE; | |
4768 | |
6982 | 4769 gaim_conversation_write(conv, who, message, flags, mtime); |
4359 | 4770 } |
4771 | |
4772 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4773 gaim_gtkconv_write_chat(GaimConversation *conv, const char *who, |
6621 | 4774 const char *message, GaimMessageFlags flags, time_t mtime) |
4359 | 4775 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4776 GaimGtkConversation *gtkconv; |
8630 | 4777 GaimConvWindow *gaimwin; |
4778 GaimGtkWindow *gtkwin; | |
4779 gboolean has_focus; | |
4359 | 4780 |
4781 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
8630 | 4782 gaimwin = gaim_conversation_get_window(conv); |
4783 gtkwin = GAIM_GTK_WINDOW(gaimwin); | |
4784 | |
4785 g_object_get(G_OBJECT(gtkwin->window), "has-toplevel-focus", &has_focus, NULL); | |
4359 | 4786 |
4382
76223649765b
[gaim-migrate @ 4648]
Christian Hammond <chipx86@chipx86.com>
parents:
4378
diff
changeset
|
4787 /* Play a sound, if specified in prefs. */ |
8630 | 4788 if (gtkconv->make_sound && !((gaim_conv_window_get_active_conversation(gaimwin) == conv) && |
8633 | 4789 !gaim_prefs_get_bool("/gaim/gtk/sound/conv_focus") && has_focus)) { |
6621 | 4790 if (!(flags & GAIM_MESSAGE_WHISPER) && (flags & GAIM_MESSAGE_SEND)) |
4561 | 4791 gaim_sound_play_event(GAIM_SOUND_CHAT_YOU_SAY); |
6621 | 4792 else if (flags & GAIM_MESSAGE_RECV) { |
4793 if ((flags & GAIM_MESSAGE_NICK) && | |
8573 | 4794 gaim_prefs_get_bool("/gaim/gtk/sound/enabled/nick_said") && |
4795 !(flags & GAIM_MESSAGE_SYSTEM)) { | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4796 |
4561 | 4797 gaim_sound_play_event(GAIM_SOUND_CHAT_NICK); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4798 } |
4359 | 4799 else |
4561 | 4800 gaim_sound_play_event(GAIM_SOUND_CHAT_SAY); |
4359 | 4801 } |
4802 } | |
4803 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4804 if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/color_nicks")) |
6621 | 4805 flags |= GAIM_MESSAGE_COLORIZE; |
4359 | 4806 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4807 /* Raise the window, if specified in prefs. */ |
6621 | 4808 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
9150 | 4809 /* we may want to change this */ |
9301 | 4810 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4811 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4812 gaim_conv_window_raise(gaim_conversation_get_window(conv)); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4813 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4814 |
6982 | 4815 gaim_conversation_write(conv, who, message, flags, mtime); |
4359 | 4816 } |
4817 | |
4818 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4819 gaim_gtkconv_write_conv(GaimConversation *conv, const char *who, |
6982 | 4820 const char *message, GaimMessageFlags flags, |
4359 | 4821 time_t mtime) |
4822 { | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
4823 GaimGtkConversation *gtkconv; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4824 GaimConvWindow *win; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
4825 GaimConnection *gc; |
4359 | 4826 int gtk_font_options = 0; |
7440 | 4827 char buf[BUF_LONG]; |
4359 | 4828 char buf2[BUF_LONG]; |
4829 char mdate[64]; | |
4830 char color[10]; | |
4831 char *str; | |
4832 char *with_font_tag; | |
4896 | 4833 char *sml_attrib = NULL; |
6982 | 4834 size_t length = strlen(message) + 1; |
4895 | 4835 |
4359 | 4836 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4837 gc = gaim_conversation_get_gc(conv); | |
4838 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4839 win = gaim_conversation_get_window(conv); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4840 |
9301 | 4841 if (!(flags & GAIM_MESSAGE_NO_LOG) && |
4842 ((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT && | |
4843 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) || | |
4844 (gaim_conversation_get_type(conv) == GAIM_CONV_IM && | |
4845 gaim_prefs_get_bool("/gaim/gtk/conversations/im/raise_on_events")))) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
4846 gaim_conv_window_show(win); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4847 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4848 |
8677 | 4849 if (gtk_text_buffer_get_char_count(gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)))) |
4850 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", 0); | |
4851 | |
5133 | 4852 if(time(NULL) > mtime + 20*60) /* show date if older than 20 minutes */ |
4853 strftime(mdate, sizeof(mdate), "%Y-%m-%d %H:%M:%S", localtime(&mtime)); | |
4854 else | |
4855 strftime(mdate, sizeof(mdate), "%H:%M:%S", localtime(&mtime)); | |
4359 | 4856 |
4896 | 4857 if(gc) |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5204
diff
changeset
|
4858 sml_attrib = g_strdup_printf("sml=\"%s\"", gc->prpl->info->name); |
7440 | 4859 |
4359 | 4860 gtk_font_options ^= GTK_IMHTML_NO_COMMENTS; |
4861 | |
9049 | 4862 #if 1 /* PREFSLASH04 */ |
4863 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_colors")) | |
4864 gtk_font_options ^= GTK_IMHTML_NO_COLOURS; | |
4865 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_fonts")) | |
4866 gtk_font_options ^= GTK_IMHTML_NO_FONTS; | |
4867 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_font_sizes")) | |
4868 gtk_font_options ^= GTK_IMHTML_NO_SIZES; | |
4869 #else | |
8944 | 4870 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_formatting")) { |
4359 | 4871 gtk_font_options ^= GTK_IMHTML_NO_COLOURS; |
4872 gtk_font_options ^= GTK_IMHTML_NO_FONTS; | |
4873 gtk_font_options ^= GTK_IMHTML_NO_SIZES; | |
8944 | 4874 } |
9049 | 4875 #endif |
4359 | 4876 |
7956 | 4877 /* this is gonna crash one day, I can feel it. */ |
4878 if (GAIM_PLUGIN_PROTOCOL_INFO(gaim_find_prpl(gaim_account_get_protocol_id(conv->account)))->options & | |
7431 | 4879 OPT_PROTO_USE_POINTSIZE) { |
5367 | 4880 gtk_font_options ^= GTK_IMHTML_USE_POINTSIZE; |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4881 } |
4359 | 4882 |
6621 | 4883 if (flags & GAIM_MESSAGE_SYSTEM) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4884 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) |
8380 | 4885 g_snprintf(buf, BUF_LONG, "<FONT SIZE=\"2\">(%s)</FONT> <B>%s</B>", |
7431 | 4886 mdate, message); |
4359 | 4887 else |
4888 g_snprintf(buf, BUF_LONG, "<B>%s</B>", message); | |
7440 | 4889 |
4359 | 4890 g_snprintf(buf2, sizeof(buf2), |
8690 | 4891 "<FONT %s><FONT SIZE=\"2\"><!--(%s) --></FONT><B>%s</B></FONT>", |
7850 | 4892 sml_attrib, mdate, message); |
7440 | 4893 |
8962 | 4894 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, 0); |
7440 | 4895 |
7583 | 4896 /* Add the message to a conversations scrollback buffer */ |
4897 conv->history = g_string_append(conv->history, buf); | |
4898 conv->history = g_string_append(conv->history, "<BR>\n"); | |
7440 | 4899 |
8722 | 4900 } else if (flags & GAIM_MESSAGE_ERROR) { |
4901 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) | |
4902 g_snprintf(buf, BUF_LONG, "<FONT SIZE=\"2\">(%s)</FONT> <B>%s</B>", | |
4903 mdate, message); | |
4904 else | |
4905 g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"#ff0000\"><B>%s</B></FONT>", message); | |
4906 | |
4907 g_snprintf(buf2, sizeof(buf2), | |
4908 "<FONT %s><FONT SIZE=\"2\"><!--(%s) --></FONT><B>%s</B></FONT>", | |
4909 sml_attrib, mdate, message); | |
4910 | |
8962 | 4911 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, 0); |
4912 | |
8722 | 4913 /* Add the message to a conversations scrollback buffer */ |
4914 conv->history = g_string_append(conv->history, buf); | |
4915 conv->history = g_string_append(conv->history, "<BR>\n"); | |
7431 | 4916 } else if (flags & GAIM_MESSAGE_NO_LOG) { |
4359 | 4917 g_snprintf(buf, BUF_LONG, |
8690 | 4918 "<B><FONT %s COLOR=\"#777777\">%s</FONT></B>", |
7850 | 4919 sml_attrib, message); |
7440 | 4920 |
8962 | 4921 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf, 0); |
4359 | 4922 } |
4923 else { | |
4895 | 4924 char *new_message = g_memdup(message, length); |
8908 | 4925 char *who_escaped = g_markup_escape_text(who, strlen(who)); |
7440 | 4926 |
6621 | 4927 if (flags & GAIM_MESSAGE_WHISPER) { |
4359 | 4928 str = g_malloc(1024); |
7440 | 4929 |
4359 | 4930 /* If we're whispering, it's not an autoresponse. */ |
7564 | 4931 if (gaim_message_meify(new_message, length)) { |
8908 | 4932 g_snprintf(str, 1024, "***%s", who_escaped); |
4359 | 4933 strcpy(color, "#6C2585"); |
4934 } | |
4935 else { | |
8908 | 4936 g_snprintf(str, 1024, "*%s*:", who_escaped); |
4359 | 4937 strcpy(color, "#00FF00"); |
4938 } | |
7440 | 4939 } |
4359 | 4940 else { |
7564 | 4941 if (gaim_message_meify(new_message, length)) { |
4359 | 4942 str = g_malloc(1024); |
7440 | 4943 |
6621 | 4944 if (flags & GAIM_MESSAGE_AUTO_RESP) |
8908 | 4945 g_snprintf(str, 1024, "%s ***%s", AUTO_RESPONSE, who_escaped); |
4359 | 4946 else |
8908 | 4947 g_snprintf(str, 1024, "***%s", who_escaped); |
7440 | 4948 |
6621 | 4949 if (flags & GAIM_MESSAGE_NICK) |
4359 | 4950 strcpy(color, "#AF7F00"); |
4951 else | |
4952 strcpy(color, "#062585"); | |
4953 } | |
4954 else { | |
4955 str = g_malloc(1024); | |
6621 | 4956 if (flags & GAIM_MESSAGE_AUTO_RESP) |
8908 | 4957 g_snprintf(str, 1024, "%s %s", who_escaped, AUTO_RESPONSE); |
4359 | 4958 else |
8908 | 4959 g_snprintf(str, 1024, "%s:", who_escaped); |
6621 | 4960 if (flags & GAIM_MESSAGE_NICK) |
4359 | 4961 strcpy(color, "#AF7F00"); |
6621 | 4962 else if (flags & GAIM_MESSAGE_RECV) { |
4963 if (flags & GAIM_MESSAGE_COLORIZE) { | |
4359 | 4964 const char *u; |
4965 int m = 0; | |
7440 | 4966 |
4359 | 4967 for (u = who; *u != '\0'; u++) |
4968 m += *u; | |
7440 | 4969 |
4359 | 4970 m = m % NUM_NICK_COLORS; |
7440 | 4971 |
4359 | 4972 strcpy(color, nick_colors[m]); |
4973 } | |
4974 else | |
7854 | 4975 strcpy(color, RECV_COLOR); |
4359 | 4976 } |
6621 | 4977 else if (flags & GAIM_MESSAGE_SEND) |
7854 | 4978 strcpy(color, SEND_COLOR); |
4359 | 4979 } |
8908 | 4980 |
4981 if(who_escaped) | |
4982 g_free(who_escaped); | |
4359 | 4983 } |
7440 | 4984 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
4985 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) |
4359 | 4986 g_snprintf(buf, BUF_LONG, |
8380 | 4987 "<FONT COLOR=\"%s\" %s><FONT SIZE=\"2\">(%s)</FONT> " |
7431 | 4988 "<B>%s</B></FONT> ", color, |
4989 sml_attrib ? sml_attrib : "", mdate, str); | |
4359 | 4990 else |
4991 g_snprintf(buf, BUF_LONG, | |
7431 | 4992 "<FONT COLOR=\"%s\" %s><B>%s</B></FONT> ", color, |
4993 sml_attrib ? sml_attrib : "", str); | |
7440 | 4994 |
4359 | 4995 g_snprintf(buf2, BUF_LONG, |
8380 | 4996 "<FONT COLOR=\"%s\" %s><FONT SIZE=\"2\"><!--(%s) --></FONT>" |
7431 | 4997 "<B>%s</B></FONT> ", |
4998 color, sml_attrib ? sml_attrib : "", mdate, str); | |
7440 | 4999 |
4359 | 5000 g_free(str); |
5001 | |
8962 | 5002 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), |
5003 buf2, 0); | |
4359 | 5004 |
4895 | 5005 if(gc){ |
4896 | 5006 char *pre = g_strdup_printf("<font %s>", sml_attrib ? sml_attrib : ""); |
4895 | 5007 char *post = "</font>"; |
5008 int pre_len = strlen(pre); | |
5009 int post_len = strlen(post); | |
7440 | 5010 |
4895 | 5011 with_font_tag = g_malloc(length + pre_len + post_len + 1); |
7440 | 5012 |
4895 | 5013 strcpy(with_font_tag, pre); |
5014 memcpy(with_font_tag + pre_len, new_message, length); | |
5015 strcpy(with_font_tag + pre_len + length, post); | |
7440 | 5016 |
4895 | 5017 length += pre_len + post_len; |
5018 g_free(pre); | |
5019 } | |
4608 | 5020 else |
4895 | 5021 with_font_tag = g_memdup(new_message, length); |
7440 | 5022 |
8962 | 5023 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), |
5024 with_font_tag, gtk_font_options); | |
7440 | 5025 |
8557 | 5026 conv->history = g_string_append(conv->history, buf); |
5027 conv->history = g_string_append(conv->history, new_message); | |
5028 conv->history = g_string_append(conv->history, "<BR>\n"); | |
7440 | 5029 |
5030 g_free(with_font_tag); | |
7447 | 5031 g_free(new_message); |
7440 | 5032 } |
5033 | |
6062 | 5034 |
5012 | 5035 if(sml_attrib) |
5036 g_free(sml_attrib); | |
4359 | 5037 } |
5038 | |
5039 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5040 gaim_gtkconv_chat_add_user(GaimConversation *conv, const char *user) |
4359 | 5041 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5042 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5043 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5044 GaimGtkChatPane *gtkchat; |
4359 | 5045 char tmp[BUF_LONG]; |
5046 int num_users; | |
5047 int pos; | |
5048 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5049 chat = GAIM_CONV_CHAT(conv); |
4359 | 5050 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5051 gtkchat = gtkconv->u.chat; | |
5052 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5053 num_users = g_list_length(gaim_conv_chat_get_users(chat)); |
4359 | 5054 |
5055 g_snprintf(tmp, sizeof(tmp), | |
5056 ngettext("%d person in room", "%d people in room", | |
5057 num_users), | |
5058 num_users); | |
5059 | |
5060 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); | |
5061 | |
5062 if (gtkconv->make_sound) | |
4561 | 5063 gaim_sound_play_event(GAIM_SOUND_CHAT_JOIN); |
4359 | 5064 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5065 pos = g_list_index(gaim_conv_chat_get_users(chat), user); |
4359 | 5066 |
5067 add_chat_buddy_common(conv, user, pos); | |
5068 } | |
5069 | |
5070 static void | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5071 gaim_gtkconv_chat_add_users(GaimConversation *conv, GList *users) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5072 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5073 GaimConvChat *chat; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5074 GaimGtkConversation *gtkconv; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5075 GaimGtkChatPane *gtkchat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5076 GList *l; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5077 char tmp[BUF_LONG]; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5078 int num_users; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5079 int pos; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5080 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5081 chat = GAIM_CONV_CHAT(conv); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5082 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5083 gtkchat = gtkconv->u.chat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5084 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5085 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
|
5086 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5087 g_snprintf(tmp, sizeof(tmp), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5088 ngettext("%d person in room", "%d people in room", |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5089 num_users), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5090 num_users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5091 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5092 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5093 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5094 for (l = users; l != NULL; l = l->next) { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5095 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
|
5096 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5097 add_chat_buddy_common(conv, (char *)l->data, pos); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5098 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5099 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5100 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5101 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5102 gaim_gtkconv_chat_rename_user(GaimConversation *conv, const char *old_name, |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5103 const char *new_name) |
4359 | 5104 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5105 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5106 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5107 GaimGtkChatPane *gtkchat; |
4359 | 5108 GtkTreeIter iter; |
5109 GtkTreeModel *model; | |
5110 GList *names; | |
5111 int pos; | |
5112 int f = 1; | |
5113 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5114 chat = GAIM_CONV_CHAT(conv); |
4359 | 5115 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5116 gtkchat = gtkconv->u.chat; | |
5117 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5118 for (names = gaim_conv_chat_get_users(chat); |
4359 | 5119 names != NULL; |
5120 names = names->next) { | |
5121 | |
5122 char *u = (char *)names->data; | |
5123 | |
4793 | 5124 if (!gaim_utf8_strcasecmp(u, old_name)) { |
4359 | 5125 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
5126 | |
5127 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
5128 break; | |
5129 | |
5130 while (f != 0) { | |
5131 char *val; | |
5132 | |
5133 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &val, -1); | |
5134 | |
4793 | 5135 if (!gaim_utf8_strcasecmp(old_name, val)) { |
4359 | 5136 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
4640 | 5137 break; |
5138 } | |
4359 | 5139 |
5140 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
5141 | |
5142 g_free(val); | |
5143 } | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
5144 |
4359 | 5145 break; |
5146 } | |
5147 } | |
5148 | |
5149 if (!names) | |
5150 return; | |
5151 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5152 pos = g_list_index(gaim_conv_chat_get_users(chat), new_name); |
4359 | 5153 |
5154 add_chat_buddy_common(conv, new_name, pos); | |
5155 } | |
5156 | |
5157 static void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5158 gaim_gtkconv_chat_remove_user(GaimConversation *conv, const char *user) |
4359 | 5159 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5160 GaimConvChat *chat; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5161 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5162 GaimGtkChatPane *gtkchat; |
4359 | 5163 GtkTreeIter iter; |
5164 GtkTreeModel *model; | |
5165 GList *names; | |
5166 char tmp[BUF_LONG]; | |
5167 int num_users; | |
5168 int f = 1; | |
5169 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5170 chat = GAIM_CONV_CHAT(conv); |
4359 | 5171 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5172 gtkchat = gtkconv->u.chat; | |
5173 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5174 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
|
5175 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5176 for (names = gaim_conv_chat_get_users(chat); |
4359 | 5177 names != NULL; |
5178 names = names->next) { | |
5179 | |
5180 char *u = (char *)names->data; | |
5181 | |
4793 | 5182 if (!gaim_utf8_strcasecmp(u, user)) { |
4359 | 5183 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
5184 | |
5185 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | |
5186 break; | |
5187 | |
5188 while (f != 0) { | |
5189 char *val; | |
5190 | |
5191 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 1, &val, -1); | |
5192 | |
4793 | 5193 if (!gaim_utf8_strcasecmp(user, val)) |
4359 | 5194 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
5195 | |
5196 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | |
5197 | |
5198 g_free(val); | |
5199 } | |
5200 | |
5201 break; | |
5202 } | |
5203 } | |
5204 | |
5205 if (names == NULL) | |
5206 return; | |
5207 | |
5208 g_snprintf(tmp, sizeof(tmp), | |
5209 ngettext("%d person in room", "%d people in room", | |
5210 num_users), num_users); | |
5211 | |
5212 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); | |
5213 | |
5214 if (gtkconv->make_sound) | |
4561 | 5215 gaim_sound_play_event(GAIM_SOUND_CHAT_LEAVE); |
4359 | 5216 } |
5217 | |
5218 static void | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5219 gaim_gtkconv_chat_remove_users(GaimConversation *conv, GList *users) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5220 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5221 GaimConvChat *chat; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5222 GaimGtkConversation *gtkconv; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5223 GaimGtkChatPane *gtkchat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5224 GtkTreeIter iter; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5225 GtkTreeModel *model; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5226 GList *names = NULL; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5227 GList *l; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5228 char tmp[BUF_LONG]; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5229 int num_users; |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
5230 gboolean f; |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5231 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5232 chat = GAIM_CONV_CHAT(conv); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5233 gtkconv = GAIM_GTK_CONVERSATION(conv); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5234 gtkchat = gtkconv->u.chat; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5235 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5236 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
|
5237 g_list_length(users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5238 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5239 for (l = users; l != NULL; l = l->next) { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5240 for (names = gaim_conv_chat_get_users(chat); |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5241 names != NULL; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5242 names = names->next) { |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5243 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5244 char *u = (char *)names->data; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5245 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5246 if (!gaim_utf8_strcasecmp(u, (char *)l->data)) { |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5247 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5248 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5249 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5250 &iter)) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5251 break; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5252 |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
5253 do { |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5254 char *val; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5255 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5256 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5257 1, &val, -1); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5258 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5259 if (!gaim_utf8_strcasecmp((char *)l->data, val)) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5260 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5261 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5262 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5263 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5264 g_free(val); |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
5265 } while (f); |
8407
15614a7cdc13
[gaim-migrate @ 9137]
Christian Hammond <chipx86@chipx86.com>
parents:
8380
diff
changeset
|
5266 |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5267 break; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5268 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5269 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5270 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5271 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5272 if (names == NULL) |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5273 return; |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5274 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5275 g_snprintf(tmp, sizeof(tmp), |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5276 ngettext("%d person in room", "%d people in room", |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5277 num_users), num_users); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5278 |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5279 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5280 } |
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5281 |
9260
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5282 static gboolean |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5283 gaim_gtkconv_has_focus(GaimConversation *conv) |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5284 { |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5285 GaimConvWindow *win; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5286 GaimGtkWindow *gtkwin; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5287 gboolean has_focus; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5288 |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5289 win = gaim_conversation_get_window(conv); |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5290 gtkwin = GAIM_GTK_WINDOW(win); |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5291 |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5292 g_object_get(G_OBJECT(gtkwin->window), "has-toplevel-focus", &has_focus, NULL); |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5293 |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5294 return has_focus; |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5295 } |
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5296 |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5297 static void |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5298 gaim_gtkconv_updated(GaimConversation *conv, GaimConvUpdateType type) |
4359 | 5299 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5300 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5301 GaimGtkWindow *gtkwin; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5302 GaimGtkConversation *gtkconv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5303 GaimGtkChatPane *gtkchat; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5304 GaimConvChat *chat; |
4359 | 5305 |
5306 win = gaim_conversation_get_window(conv); | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5307 gtkwin = GAIM_GTK_WINDOW(win); |
4359 | 5308 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5309 | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5310 if (type == GAIM_CONV_UPDATE_ACCOUNT) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5311 { |
4359 | 5312 gaim_conversation_autoset_title(conv); |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5313 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5314 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5315 gaim_gtkconv_update_buddy_icon(conv); |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
5316 |
4359 | 5317 gaim_gtkconv_update_buttons_by_protocol(conv); |
5318 | |
4685 | 5319 g_timeout_add(0, (GSourceFunc)update_send_as_selection, win); |
4359 | 5320 |
5321 smiley_themeize(gtkconv->imhtml); | |
6394 | 5322 |
6395 | 5323 update_tab_icon(conv); |
4359 | 5324 } |
5325 else if (type == GAIM_CONV_UPDATE_TYPING || | |
8155
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5326 type == GAIM_CONV_UPDATE_UNSEEN || |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5327 type == GAIM_CONV_UPDATE_TITLE) |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5328 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5329 const char *title; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5330 GaimConvIm *im = NULL; |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5331 char color[8]; |
4736 | 5332 |
4359 | 5333 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5334 im = GAIM_CONV_IM(conv); |
4359 | 5335 |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5336 title = gaim_conversation_get_title(conv); |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5337 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5338 *color = '\0'; |
4359 | 5339 |
5340 if (!GTK_WIDGET_REALIZED(gtkconv->tab_label)) | |
5341 gtk_widget_realize(gtkconv->tab_label); | |
5342 | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5343 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
|
5344 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5345 strcpy(color, "#47A046"); |
4359 | 5346 } |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5347 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
|
5348 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5349 strcpy(color, "#D1940C"); |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5350 } |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5351 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_NICK) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5352 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5353 strcpy(color, "#314E6C"); |
4359 | 5354 } |
8252 | 5355 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_TEXT) |
5356 { | |
5357 strcpy(color, "#DF421E"); | |
5358 } | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5359 else if (gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_EVENT) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5360 { |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5361 strcpy(color, "#868272"); |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5362 } |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5363 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5364 if (*color != '\0') |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5365 { |
8536 | 5366 char *html_title,*label; |
5367 | |
5368 html_title = gaim_escape_html(title); | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5369 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5370 label = g_strdup_printf("<span color=\"%s\">%s</span>", |
8536 | 5371 color, html_title); |
5372 g_free(html_title); | |
7995
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
5373 gtk_label_set_markup(GTK_LABEL(gtkconv->tab_label), label); |
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
5374 g_free(label); |
4359 | 5375 } |
7995
87d3260f961a
[gaim-migrate @ 8672]
Christian Hammond <chipx86@chipx86.com>
parents:
7990
diff
changeset
|
5376 else |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5377 gtk_label_set_text(GTK_LABEL(gtkconv->tab_label), title); |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5378 |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5379 if (conv == gaim_conv_window_get_active_conversation(win)) |
4736 | 5380 update_typing_icon(conv); |
8155
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5381 |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5382 if (type == GAIM_CONV_UPDATE_TITLE) { |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5383 gtk_label_set_text(GTK_LABEL(gtkconv->menu_label), title); |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5384 if (conv == gaim_conv_window_get_active_conversation(win)) |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5385 gtk_window_set_title(GTK_WINDOW(gtkwin->window), title); |
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5386 } |
4359 | 5387 } |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5388 else if (type == GAIM_CONV_UPDATE_TOPIC) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5389 { |
7154 | 5390 const char *topic; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5391 chat = GAIM_CONV_CHAT(conv); |
4359 | 5392 gtkchat = gtkconv->u.chat; |
5393 | |
7154 | 5394 topic = gaim_conv_chat_get_topic(chat); |
5395 | |
5396 gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text),topic); | |
5397 gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->topic_text, | |
8155
77d1252b3803
[gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents:
8143
diff
changeset
|
5398 topic, NULL); |
4359 | 5399 } |
5400 else if (type == GAIM_CONV_ACCOUNT_ONLINE || | |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5401 type == GAIM_CONV_ACCOUNT_OFFLINE) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5402 { |
7929 | 5403 gray_stuff_out(gaim_conv_window_get_active_conversation(win)); |
4360
c435a29370b8
[gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
5404 generate_send_as_items(win, NULL); |
8946 | 5405 update_tab_icon(conv); |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
5406 } |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5407 else if (type == GAIM_CONV_UPDATE_AWAY) |
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5408 { |
8946 | 5409 update_tab_icon(conv); |
4359 | 5410 } |
8256
1d86096ae0f4
[gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents:
8253
diff
changeset
|
5411 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
|
5412 type == GAIM_CONV_UPDATE_CHATLEFT) |
8001
934f5df83b29
[gaim-migrate @ 8678]
Christian Hammond <chipx86@chipx86.com>
parents:
7996
diff
changeset
|
5413 { |
7929 | 5414 gray_stuff_out(conv); |
4397
ce3a0eba91ef
[gaim-migrate @ 4666]
Christian Hammond <chipx86@chipx86.com>
parents:
4387
diff
changeset
|
5415 } |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5416 else if (type == GAIM_CONV_UPDATE_ICON) |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5417 { |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5418 gaim_gtkconv_update_buddy_icon(conv); |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5419 } |
4359 | 5420 } |
5421 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5422 static GaimConversationUiOps conversation_ui_ops = |
4359 | 5423 { |
5424 gaim_gtkconv_destroy, /* destroy_conversation */ | |
5425 gaim_gtkconv_write_chat, /* write_chat */ | |
5426 gaim_gtkconv_write_im, /* write_im */ | |
5427 gaim_gtkconv_write_conv, /* write_conv */ | |
5428 gaim_gtkconv_chat_add_user, /* chat_add_user */ | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5429 gaim_gtkconv_chat_add_users, /* chat_add_users */ |
4359 | 5430 gaim_gtkconv_chat_rename_user, /* chat_rename_user */ |
5431 gaim_gtkconv_chat_remove_user, /* chat_remove_user */ | |
6407
ba0b99a72be2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
5432 gaim_gtkconv_chat_remove_users, /* chat_remove_users */ |
4359 | 5433 NULL, /* update_progress */ |
9260
947876140943
[gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents:
9247
diff
changeset
|
5434 gaim_gtkconv_has_focus, /* has_focus */ |
4359 | 5435 gaim_gtkconv_updated /* updated */ |
5436 }; | |
5437 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5438 GaimConversationUiOps * |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
5439 gaim_gtk_conversations_get_conv_ui_ops(void) |
4359 | 5440 { |
4465
6e37eb000b7a
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4454
diff
changeset
|
5441 return &conversation_ui_ops; |
4359 | 5442 } |
5443 | |
5444 /************************************************************************** | |
5445 * Public conversation utility functions | |
5446 **************************************************************************/ | |
5447 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5448 gaim_gtkconv_update_buddy_icon(GaimConversation *conv) |
4359 | 5449 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5450 GaimGtkConversation *gtkconv; |
7143 | 5451 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); |
4359 | 5452 |
5453 char filename[256]; | |
5454 FILE *file; | |
5455 GError *err = NULL; | |
5456 | |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5457 const void *data; |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6771
diff
changeset
|
5458 size_t len; |
4359 | 5459 |
5460 GdkPixbuf *buf; | |
5461 | |
8821 | 5462 GtkWidget *vbox; |
4359 | 5463 GtkWidget *event; |
5464 GtkWidget *frame; | |
5465 GdkPixbuf *scale; | |
5466 GdkPixmap *pm; | |
5467 GdkBitmap *bm; | |
9318 | 5468 int scale_width, scale_height; |
9332 | 5469 GtkRequisition requisition; |
9318 | 5470 |
5471 GaimAccount *account; | |
5472 GaimPluginProtocolInfo *prpl_info = NULL; | |
4359 | 5473 |
8821 | 5474 GaimButtonStyle button_type; |
5475 | |
9324 | 5476 GaimBuddyIcon *icon; |
5477 | |
5678
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5478 g_return_if_fail(conv != NULL); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5479 g_return_if_fail(GAIM_IS_GTK_CONVERSATION(conv)); |
619bca773b2e
[gaim-migrate @ 6096]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5480 g_return_if_fail(gaim_conversation_get_type(conv) == GAIM_CONV_IM); |
4359 | 5481 |
5482 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
9318 | 5483 account = gaim_conversation_get_account(conv); |
5484 if(account && account->gc) | |
5485 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl); | |
4359 | 5486 |
5487 remove_icon(gtkconv); | |
5488 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5484
diff
changeset
|
5489 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/im/show_buddy_icons")) |
4359 | 5490 return; |
5491 | |
5492 if (gaim_conversation_get_gc(conv) == NULL) | |
5493 return; | |
5494 | |
8189 | 5495 if (gtkconv->u.im->anim) |
4793 | 5496 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); |
5497 | |
9324 | 5498 |
5499 | |
5500 icon = gaim_conv_im_get_icon(GAIM_CONV_IM(conv)); | |
5501 | |
5502 if (icon == NULL) | |
5503 return; | |
5504 | |
5505 data = gaim_buddy_icon_get_data(icon, &len); | |
5506 | |
5507 /* this is such an evil hack, i don't know why i'm even considering it. | |
5508 * we'll do it differently when gdk-pixbuf-loader isn't leaky anymore. */ | |
5509 /* gdk-pixbuf-loader was leaky? is it still? */ | |
5510 g_snprintf(filename, sizeof(filename), | |
5511 "%s" G_DIR_SEPARATOR_S "gaimicon-%s.%d", | |
5512 g_get_tmp_dir(), gaim_conversation_get_name(conv), getpid()); | |
5513 | |
5514 if (!(file = fopen(filename, "wb"))) | |
5515 return; | |
5516 | |
5517 fwrite(data, 1, len, file); | |
5518 fclose(file); | |
5519 | |
5520 gtkconv->u.im->anim = gdk_pixbuf_animation_new_from_file(filename, &err); | |
5521 /* make sure we remove the file as soon as possible */ | |
5522 unlink(filename); | |
5523 | |
4359 | 5524 |
5525 if (err) { | |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5526 gaim_debug(GAIM_DEBUG_ERROR, "gtkconv", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
5527 "Buddy icon error: %s\n", err->message); |
4359 | 5528 g_error_free(err); |
5529 } | |
5530 | |
5531 if (!gtkconv->u.im->anim) | |
5532 return; | |
5533 | |
4793 | 5534 if(gtkconv->u.im->iter) |
5535 g_object_unref(G_OBJECT(gtkconv->u.im->iter)); | |
5536 | |
4359 | 5537 if (gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim)) { |
5538 gtkconv->u.im->iter = NULL; | |
5539 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); | |
5540 } else { | |
5541 gtkconv->u.im->iter = | |
8496 | 5542 gdk_pixbuf_animation_get_iter(gtkconv->u.im->anim, NULL); /* LEAK */ |
4359 | 5543 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); |
8189 | 5544 if (gtkconv->u.im->animate) |
5545 start_anim(NULL, conv); | |
4359 | 5546 } |
5547 | |
9318 | 5548 get_icon_scale_size(gtkconv->u.im->anim, prpl_info ? &prpl_info->icon_spec : |
5549 NULL, &scale_width, &scale_height); | |
4359 | 5550 scale = gdk_pixbuf_scale_simple(buf, |
9318 | 5551 MAX(gdk_pixbuf_get_width(buf) * scale_width / |
4359 | 5552 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), |
9318 | 5553 MAX(gdk_pixbuf_get_height(buf) * scale_height / |
4359 | 5554 gdk_pixbuf_animation_get_height(gtkconv->u.im->anim), 1), |
5555 GDK_INTERP_NEAREST); | |
5556 | |
5557 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); | |
4793 | 5558 g_object_unref(G_OBJECT(scale)); |
4359 | 5559 |
8821 | 5560 |
5561 vbox = gtk_vbox_new(FALSE, 0); | |
5562 | |
4359 | 5563 frame = gtk_frame_new(NULL); |
5564 gtk_frame_set_shadow_type(GTK_FRAME(frame), | |
5565 (bm ? GTK_SHADOW_NONE : GTK_SHADOW_IN)); | |
8821 | 5566 gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); |
5567 | |
4359 | 5568 event = gtk_event_box_new(); |
5569 gtk_container_add(GTK_CONTAINER(frame), event); | |
5314
1f901484599d
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5228
diff
changeset
|
5570 g_signal_connect(G_OBJECT(event), "button-press-event", |
4359 | 5571 G_CALLBACK(icon_menu), conv); |
5572 gtk_widget_show(event); | |
5573 | |
4635 | 5574 gtkconv->u.im->icon = gtk_image_new_from_pixmap(pm, bm); |
9318 | 5575 gtk_widget_set_size_request(gtkconv->u.im->icon, scale_width, scale_height); |
4359 | 5576 gtk_container_add(GTK_CONTAINER(event), gtkconv->u.im->icon); |
5577 gtk_widget_show(gtkconv->u.im->icon); | |
5578 | |
4793 | 5579 g_object_unref(G_OBJECT(pm)); |
4359 | 5580 |
5581 if (bm) | |
4793 | 5582 g_object_unref(G_OBJECT(bm)); |
7143 | 5583 |
9332 | 5584 button_type = gaim_prefs_get_int("/gaim/gtk/conversations/button_type"); |
5585 gtk_widget_size_request(gtkconv->bbox, &requisition); | |
5586 if(button_type == GAIM_BUTTON_NONE || requisition.height < scale_height) { | |
5587 gtk_box_pack_start(GTK_BOX(gtkconv->lower_hbox), vbox, FALSE, FALSE, 0); | |
5588 /* gtk_box_reorder_child(GTK_BOX(gtkconv->lower_hbox), vbox, 0); */ | |
5589 } else { | |
5590 gtk_box_pack_start(GTK_BOX(gtkconv->bbox), vbox, FALSE, FALSE, 0); | |
5591 gtk_box_reorder_child(GTK_BOX(gtkconv->bbox), vbox, 0); | |
5592 } | |
5593 | |
5594 gtk_widget_show(vbox); | |
5595 gtk_widget_show(frame); | |
5596 | |
7143 | 5597 /* The buddy icon code needs badly to be fixed. */ |
5598 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); | |
8068 | 5599 if(conv == gaim_conv_window_get_active_conversation(gaim_conversation_get_window(conv))) |
5600 gtk_window_set_icon(GTK_WINDOW(gtkwin->window), buf); | |
4359 | 5601 } |
5602 | |
5603 void | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5604 gaim_gtkconv_update_buttons_by_protocol(GaimConversation *conv) |
4359 | 5605 { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5606 GaimConvWindow *win; |
4359 | 5607 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5608 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
4359 | 5609 return; |
5610 | |
7887 | 5611 win = gaim_conversation_get_window(conv); |
5612 | |
5613 if (win != NULL && gaim_conv_window_get_active_conversation(win) == conv) | |
5614 gray_stuff_out(conv); | |
4359 | 5615 } |
5616 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5617 GaimConvWindow * |
4359 | 5618 gaim_gtkwin_get_at_xy(int x, int y) |
5619 { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5620 GaimConvWindow *win = NULL; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5621 GaimGtkWindow *gtkwin; |
4359 | 5622 GdkWindow *gdkwin; |
5623 GList *l; | |
5624 | |
5625 gdkwin = gdk_window_at_pointer(&x, &y); | |
5626 | |
5627 if (gdkwin) | |
5628 gdkwin = gdk_window_get_toplevel(gdkwin); | |
5629 | |
5630 for (l = gaim_get_windows(); l != NULL; l = l->next) { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5631 win = (GaimConvWindow *)l->data; |
4359 | 5632 |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5633 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5634 continue; |
5635 | |
5636 gtkwin = GAIM_GTK_WINDOW(win); | |
5637 | |
5638 if (gdkwin == gtkwin->window->window) | |
5639 return win; | |
5640 } | |
5641 | |
5642 return NULL; | |
5643 } | |
5644 | |
5645 int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5646 gaim_gtkconv_get_tab_at_xy(GaimConvWindow *win, int x, int y) |
4359 | 5647 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5648 GaimGtkWindow *gtkwin; |
4359 | 5649 GList *l; |
5650 gint nb_x, nb_y, x_rel, y_rel; | |
5651 GtkNotebook *notebook; | |
5652 GtkWidget *tab; | |
5653 gint i, page_num = 0; | |
5654 gboolean first_visible = TRUE; | |
5655 | |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5656 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5657 return -1; |
5658 | |
5659 gtkwin = GAIM_GTK_WINDOW(win); | |
5660 notebook = GTK_NOTEBOOK(gtkwin->notebook); | |
5661 | |
5662 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
5663 x_rel = x - nb_x; | |
5664 y_rel = y - nb_y; | |
5665 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5666 for (l = gaim_conv_window_get_conversations(win), i = 0; |
4359 | 5667 l != NULL; |
5668 l = l->next, i++) { | |
5669 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5670 GaimConversation *conv = l->data; |
4359 | 5671 tab = GAIM_GTK_CONVERSATION(conv)->tab_label; |
5672 | |
5673 if (!GTK_WIDGET_MAPPED(tab)) | |
5674 continue; | |
5675 | |
5676 if (first_visible) { | |
5677 first_visible = FALSE; | |
5678 | |
5679 if (x_rel < tab->allocation.x) x_rel = tab->allocation.x; | |
5680 if (y_rel < tab->allocation.y) y_rel = tab->allocation.y; | |
5681 } | |
5682 | |
5683 if (gtk_notebook_get_tab_pos(notebook) == GTK_POS_TOP || | |
5684 gtk_notebook_get_tab_pos(notebook) == GTK_POS_BOTTOM) { | |
5685 | |
5686 if (tab->allocation.x <= x_rel) { | |
5687 if (tab->allocation.x + tab->allocation.width <= x_rel) | |
5688 page_num = i + 1; | |
5689 else | |
5690 page_num = i; | |
5691 } | |
5692 else | |
5693 break; | |
5694 } | |
5695 else { | |
5696 if (tab->allocation.y <= y_rel) { | |
5697 if (tab->allocation.y + tab->allocation.height <= y_rel) | |
5698 page_num = i + 1; | |
5699 else | |
5700 page_num = i; | |
5701 } | |
5702 else | |
5703 break; | |
5704 } | |
5705 } | |
5706 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5707 if (i == gaim_conv_window_get_conversation_count(win) + 1) |
4359 | 5708 return -1; |
5709 | |
5710 return page_num; | |
5711 } | |
5712 | |
5713 int | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5714 gaim_gtkconv_get_dest_tab_at_xy(GaimConvWindow *win, int x, int y) |
4359 | 5715 { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5716 GaimGtkWindow *gtkwin; |
4359 | 5717 GList *l; |
5718 gint nb_x, nb_y, x_rel, y_rel; | |
5719 GtkNotebook *notebook; | |
5720 GtkWidget *tab; | |
5721 gint i, page_num = 0; | |
5722 | |
4398
a8249a5250b6
[gaim-migrate @ 4667]
Christian Hammond <chipx86@chipx86.com>
parents:
4397
diff
changeset
|
5723 if (!GAIM_IS_GTK_WINDOW(win)) |
4359 | 5724 return -1; |
5725 | |
5726 gtkwin = GAIM_GTK_WINDOW(win); | |
5727 notebook = GTK_NOTEBOOK(gtkwin->notebook); | |
5728 | |
5729 gdk_window_get_origin(gtkwin->notebook->window, &nb_x, &nb_y); | |
5730 x_rel = x - nb_x; | |
5731 y_rel = y - nb_y; | |
5732 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5733 for (l = gaim_conv_window_get_conversations(win), i = 0; |
4359 | 5734 l != NULL; |
5735 l = l->next, i++) { | |
5736 | |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5737 GaimConversation *conv = l->data; |
4359 | 5738 tab = GAIM_GTK_CONVERSATION(conv)->tab_label; |
5739 | |
5740 if (!GTK_WIDGET_MAPPED(tab)) | |
5741 continue; | |
5742 | |
5743 if (gtk_notebook_get_tab_pos(notebook) == GTK_POS_TOP || | |
5744 gtk_notebook_get_tab_pos(notebook) == GTK_POS_BOTTOM) { | |
5745 | |
5746 if (tab->allocation.x <= x_rel) { | |
5747 if (tab->allocation.x + (tab->allocation.width / 2) <= x_rel) | |
5748 page_num = i + 1; | |
5749 else | |
5750 page_num = i; | |
5751 } | |
5752 else | |
5753 break; | |
5754 } | |
5755 else { | |
5756 if (tab->allocation.y <= y_rel) { | |
5757 if (tab->allocation.y + (tab->allocation.height / 2) <= y_rel) | |
5758 page_num = i + 1; | |
5759 else | |
5760 page_num = i; | |
5761 } | |
5762 else | |
5763 break; | |
5764 } | |
5765 } | |
5766 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5767 if (i == gaim_conv_window_get_conversation_count(win) + 1) |
4359 | 5768 return -1; |
5769 | |
5770 return page_num; | |
5771 } | |
4940
3708545afe42
[gaim-migrate @ 5274]
Christian Hammond <chipx86@chipx86.com>
parents:
4939
diff
changeset
|
5772 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5773 static void |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5774 escape_closes_pref_cb(const char *name, GaimPrefType type, gpointer value, |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5775 gpointer data) |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5776 { |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5777 if (value) |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5778 gtk_accel_map_change_entry(N_("<main>/Conversation/Close"), |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5779 GDK_Escape, 0, TRUE); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5780 else |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5781 gtk_accel_map_change_entry(N_("<main>/Conversation/Close"), |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5782 GDK_W, GDK_CONTROL_MASK, TRUE); |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5783 } |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5784 |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
5785 static void |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5786 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
|
5787 gpointer data) |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5788 { |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5789 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5790 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5791 GaimGtkConversation *gtkconv; |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5792 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5793 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5794 conv = (GaimConversation *)l->data; |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5795 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5796 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5797 continue; |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5798 |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5799 gtkconv = GAIM_GTK_CONVERSATION(conv); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5800 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5801 if (value) |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5802 gtk_widget_show(gtkconv->close); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5803 else |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5804 gtk_widget_hide(gtkconv->close); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5805 } |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5806 } |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
5807 |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5808 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5809 show_timestamps_pref_cb(const char *name, GaimPrefType type, gpointer value, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5810 gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5811 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5812 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5813 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5814 GaimGtkConversation *gtkconv; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5815 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5816 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5817 conv = (GaimConversation *)l->data; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5818 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5819 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5820 continue; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5821 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5822 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5823 |
7386 | 5824 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
|
5825 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5826 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5827 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5828 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5829 spellcheck_pref_cb(const char *name, GaimPrefType type, gpointer value, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5830 gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5831 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5832 #ifdef USE_GTKSPELL |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5833 GList *cl; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5834 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5835 GaimGtkConversation *gtkconv; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5836 GtkSpell *spell; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5837 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5838 for (cl = gaim_get_conversations(); cl != NULL; cl = cl->next) { |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
5839 |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5840 conv = (GaimConversation *)cl->data; |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5841 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5842 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5843 continue; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5844 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5845 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5846 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5847 if (value) |
7538
357eb1c39b72
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7476
diff
changeset
|
5848 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5849 else { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5850 spell = gtkspell_get_from_text_view(GTK_TEXT_VIEW(gtkconv->entry)); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5851 gtkspell_detach(spell); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5852 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5853 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5854 #endif |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5855 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5856 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5857 static void |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5858 tab_side_pref_cb(const char *name, GaimPrefType type, gpointer value, |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5859 gpointer data) |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5860 { |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5861 GList *l; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5862 GtkPositionType pos; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5863 GaimConvWindow *win; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5864 GaimGtkWindow *gtkwin; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5865 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5866 pos = GPOINTER_TO_INT(value); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5867 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5868 for (l = gaim_get_windows(); l != NULL; l = l->next) { |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
5869 win = (GaimConvWindow *)l->data; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5870 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5871 if (!GAIM_IS_GTK_WINDOW(win)) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5872 continue; |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5873 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5874 gtkwin = GAIM_GTK_WINDOW(win); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5875 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5876 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(gtkwin->notebook), pos); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5877 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5878 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5879 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5880 static void |
8456 | 5881 html_shortcuts_pref_cb(const char *name, GaimPrefType type, |
5882 gpointer value, gpointer data) | |
5883 { | |
5884 GList *l; | |
5885 GaimConversation *conv; | |
5886 GaimGtkConversation *gtkconv; | |
5887 | |
5888 for(l = gaim_get_conversations(); l != NULL; l = l->next) { | |
5889 conv = (GaimConversation *)l->data; | |
5890 | |
5891 if(!GAIM_IS_GTK_CONVERSATION(conv)) | |
5892 continue; | |
5893 | |
5894 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5895 | |
5896 gtk_imhtml_html_shortcuts(GTK_IMHTML(gtkconv->entry), | |
5897 (gboolean)GPOINTER_TO_INT(value)); | |
5898 } | |
5899 } | |
5900 | |
5901 static void | |
5902 smiley_shortcuts_pref_cb(const char *name, GaimPrefType type, | |
5903 gpointer value, gpointer data) | |
5904 { | |
5905 GList *l; | |
5906 GaimConversation *conv; | |
5907 GaimGtkConversation *gtkconv; | |
5908 | |
5909 for(l = gaim_get_conversations(); l != NULL; l = l->next) { | |
5910 conv = (GaimConversation *)l->data; | |
5911 | |
5912 if(!GAIM_IS_GTK_CONVERSATION(conv)) | |
5913 continue; | |
5914 | |
5915 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5916 | |
5917 gtk_imhtml_smiley_shortcuts(GTK_IMHTML(gtkconv->entry), | |
5918 (gboolean)GPOINTER_TO_INT(value)); | |
5919 } | |
5920 } | |
5921 | |
5922 static void | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5923 show_formatting_toolbar_pref_cb(const char *name, GaimPrefType type, |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5924 gpointer value, gpointer data) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5925 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5926 GList *l; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5927 GaimConversation *conv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5928 GaimGtkConversation *gtkconv; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5929 GaimConvWindow *win; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5930 GaimGtkWindow *gtkwin; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5931 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5932 for (l = gaim_get_conversations(); l != NULL; l = l->next) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5933 { |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5934 conv = (GaimConversation *)l->data; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5935 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5936 if (!GAIM_IS_GTK_CONVERSATION(conv)) |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5937 continue; |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5938 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5939 gtkconv = GAIM_GTK_CONVERSATION(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5940 win = gaim_conversation_get_window(conv); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5941 gtkwin = GAIM_GTK_WINDOW(win); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5942 |
7386 | 5943 gtkconv->show_formatting_toolbar = (gboolean)GPOINTER_TO_INT(value); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5944 gtk_check_menu_item_set_active( |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5945 GTK_CHECK_MENU_ITEM(gtkwin->menu.show_formatting_toolbar), |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5946 gtkconv->show_formatting_toolbar); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5947 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5948 if (gtkconv->show_formatting_toolbar) |
8317 | 5949 gtk_widget_show(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5950 else |
8317 | 5951 gtk_widget_hide(gtkconv->toolbar); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5952 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5953 } |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5954 |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
5955 static void |
9150 | 5956 button_type_pref_cb(const char *name, GaimPrefType type, |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5957 gpointer value, gpointer data) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5958 { |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5959 GList *l; |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5960 GaimConversation *conv; |
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5961 GaimGtkConversation *gtkconv; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5962 |
9150 | 5963 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5675
diff
changeset
|
5964 conv = (GaimConversation *)l->data; |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5965 gtkconv = GAIM_GTK_CONVERSATION(conv); |
9150 | 5966 switch (conv->type) { |
5967 case GAIM_CONV_IM: | |
5968 setup_im_buttons(conv, gtk_widget_get_parent(gtkconv->send)); | |
5969 gaim_gtkconv_update_buddy_icon(conv); | |
5970 break; | |
5971 case GAIM_CONV_CHAT: | |
5972 setup_chat_buttons(conv, gtk_widget_get_parent(gtkconv->send)); | |
5973 break; | |
5974 default: | |
5975 break; | |
5976 } | |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
5977 } |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5978 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5979 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5980 static void |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5981 animate_buddy_icons_pref_cb(const char *name, GaimPrefType type, |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5982 gpointer value, gpointer data) |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5983 { |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5984 GList *l; |
8189 | 5985 GaimConversation *conv; |
5986 GaimGtkConversation *gtkconv; | |
5987 GaimConvWindow *win; | |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5988 |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5989 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
|
5990 return; |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5991 |
8189 | 5992 /* Set the "animate" flag for each icon based on the new preference */ |
5993 for (l = gaim_get_ims(); l != NULL; l = l->next) { | |
5994 conv = (GaimConversation *)l->data; | |
5995 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
5996 gtkconv->u.im->animate = (gboolean)value; | |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
5997 } |
8189 | 5998 |
5999 /* Now either stop or start animation for the active conversation in each window */ | |
6000 for (l = gaim_get_windows(); l != NULL; l = l->next) { | |
6001 win = (GaimConvWindow *)l->data; | |
6002 conv = gaim_conv_window_get_active_conversation(win); | |
6003 gaim_gtkconv_update_buddy_icon(conv); | |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6004 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6005 } |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6006 |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6007 static void |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6008 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
|
6009 gpointer data) |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6010 { |
5881
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6011 GList *l; |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6012 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6013 for (l = gaim_get_conversations(); l != NULL; l = l->next) { |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6014 GaimConversation *conv = l->data; |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6015 |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6016 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6017 gaim_conversation_foreach(gaim_gtkconv_update_buddy_icon); |
cc7870e1e3b3
[gaim-migrate @ 6313]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
6018 } |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6019 } |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6020 |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5680
diff
changeset
|
6021 static void |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6022 conv_placement_pref_cb(const char *name, GaimPrefType type, |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6023 gpointer value, gpointer data) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6024 { |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6025 GaimConvPlacementFunc func; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6026 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6027 if (strcmp(name, "/gaim/gtk/conversations/placement")) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6028 return; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6029 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6030 func = gaim_conv_placement_get_fnc(value); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6031 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6032 if (func == NULL) |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6033 return; |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6034 |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6035 gaim_conv_placement_set_current_func(func); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6036 } |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6037 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6038 void * |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6039 gaim_gtk_conversations_get_handle(void) |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6040 { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6041 static int handle; |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6042 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6043 return &handle; |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6044 } |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6045 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6046 void |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7008
diff
changeset
|
6047 gaim_gtk_conversations_init(void) |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6048 { |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6049 void *handle = gaim_gtk_conversations_get_handle(); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6050 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6051 /* Conversations */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6052 gaim_prefs_add_none("/gaim/gtk/conversations"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6053 gaim_prefs_add_bool("/gaim/gtk/conversations/close_on_tabs", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6054 gaim_prefs_add_bool("/gaim/gtk/conversations/ctrl_enter_sends", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6055 gaim_prefs_add_bool("/gaim/gtk/conversations/enter_sends", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6056 gaim_prefs_add_bool("/gaim/gtk/conversations/escape_closes", FALSE); |
9025 | 6057 gaim_prefs_add_bool("/gaim/gtk/conversations/send_formatting", FALSE); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6058 gaim_prefs_add_bool("/gaim/gtk/conversations/send_bold", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6059 gaim_prefs_add_bool("/gaim/gtk/conversations/send_italic", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6060 gaim_prefs_add_bool("/gaim/gtk/conversations/send_underline", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6061 gaim_prefs_add_bool("/gaim/gtk/conversations/show_timestamps", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6062 gaim_prefs_add_bool("/gaim/gtk/conversations/spellcheck", TRUE); |
9049 | 6063 #if 1 |
6064 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_colors", FALSE); | |
6065 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_fonts", FALSE); | |
6066 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_font_sizes", FALSE); | |
6067 #else | |
8944 | 6068 gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_formatting", FALSE); |
9049 | 6069 #endif |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6070 gaim_prefs_add_bool("/gaim/gtk/conversations/html_shortcuts", FALSE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6071 gaim_prefs_add_bool("/gaim/gtk/conversations/smiley_shortcuts", FALSE); |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6072 gaim_prefs_add_bool("/gaim/gtk/conversations/show_formatting_toolbar", TRUE); |
9130 | 6073 gaim_prefs_add_bool("/gaim/gtk/conversations/enable_commands", TRUE); |
6074 | |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6075 gaim_prefs_add_string("/gaim/gtk/conversations/placement", "last"); |
8998 | 6076 gaim_prefs_add_int("/gaim/gtk/conversations/placement_number", 1); |
9025 | 6077 gaim_prefs_add_string("/gaim/gtk/conversations/bgcolor", ""); |
6078 gaim_prefs_add_string("/gaim/gtk/conversations/fgcolor", ""); | |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6079 gaim_prefs_add_string("/gaim/gtk/conversations/font_face", ""); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6080 gaim_prefs_add_int("/gaim/gtk/conversations/font_size", 3); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6081 gaim_prefs_add_bool("/gaim/gtk/conversations/tabs", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6082 gaim_prefs_add_int("/gaim/gtk/conversations/tab_side", GTK_POS_TOP); |
9150 | 6083 gaim_prefs_add_int("/gaim/gtk/conversations/button_type", |
6084 GAIM_BUTTON_TEXT_IMAGE); | |
6085 | |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6086 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6087 /* Conversations -> Chat */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6088 gaim_prefs_add_none("/gaim/gtk/conversations/chat"); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6089 gaim_prefs_add_bool("/gaim/gtk/conversations/chat/color_nicks", TRUE); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6090 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_width", 410); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6091 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_height", 160); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6092 gaim_prefs_add_int("/gaim/gtk/conversations/chat/entry_height", 50); |
9319 | 6093 gaim_prefs_add_bool("/gaim/gtk/conversations/chat/raise_on_events", FALSE); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6094 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6095 /* Conversations -> IM */ |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6096 gaim_prefs_add_none("/gaim/gtk/conversations/im"); |
9150 | 6097 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6098 gaim_prefs_add_bool("/gaim/gtk/conversations/im/animate_buddy_icons", TRUE); |
9150 | 6099 |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6100 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_width", 410); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6101 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_height", 160); |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6102 gaim_prefs_add_int("/gaim/gtk/conversations/im/entry_height", 50); |
9319 | 6103 gaim_prefs_add_bool("/gaim/gtk/conversations/im/raise_on_events", FALSE); |
6104 gaim_prefs_add_bool("/gaim/gtk/conversations/im/show_buddy_icons", TRUE); | |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6105 |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6106 /* Connect callbacks. */ |
6398
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6107 gaim_prefs_connect_callback("/gaim/gtk/conversations/escape_closes", |
c9894c0fbc6f
[gaim-migrate @ 6903]
Christian Hammond <chipx86@chipx86.com>
parents:
6395
diff
changeset
|
6108 escape_closes_pref_cb, NULL); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6109 gaim_prefs_connect_callback("/gaim/gtk/conversations/close_on_tabs", |
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6110 close_on_tabs_pref_cb, NULL); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6111 gaim_prefs_connect_callback("/gaim/gtk/conversations/show_timestamps", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6112 show_timestamps_pref_cb, NULL); |
8456 | 6113 gaim_prefs_connect_callback("/gaim/gtk/conversations/html_shortcuts", |
6114 html_shortcuts_pref_cb, NULL); | |
6115 gaim_prefs_connect_callback("/gaim/gtk/conversations/smiley_shortcuts", | |
6116 smiley_shortcuts_pref_cb, NULL); | |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6117 gaim_prefs_connect_callback("/gaim/gtk/conversations/show_formatting_toolbar", |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7322
diff
changeset
|
6118 show_formatting_toolbar_pref_cb, NULL); |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6119 gaim_prefs_connect_callback("/gaim/gtk/conversations/spellcheck", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6120 spellcheck_pref_cb, NULL); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6121 gaim_prefs_connect_callback("/gaim/gtk/conversations/tab_side", |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6122 tab_side_pref_cb, NULL); |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6123 |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6124 gaim_prefs_connect_callback("/gaim/gtk/conversations/placement", |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6125 conv_placement_pref_cb, NULL); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6126 gaim_prefs_trigger_callback("/gaim/gtk/conversations/placement"); |
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
6127 |
9150 | 6128 gaim_prefs_connect_callback("/gaim/gtk/conversations/button_type", |
6129 button_type_pref_cb, NULL); | |
6725
e62a504c83d0
[gaim-migrate @ 7252]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
6130 |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6131 /* IM callbacks */ |
5674
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6132 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/animate_buddy_icons", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6133 animate_buddy_icons_pref_cb, NULL); |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6134 gaim_prefs_connect_callback("/gaim/gtk/conversations/im/show_buddy_icons", |
2d86a5fa6fef
[gaim-migrate @ 6092]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
6135 show_buddy_icons_pref_cb, NULL); |
5675
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6136 |
17e345ffeddb
[gaim-migrate @ 6093]
Christian Hammond <chipx86@chipx86.com>
parents:
5674
diff
changeset
|
6137 |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6138 /********************************************************************** |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6139 * Register signals |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6140 **********************************************************************/ |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6141 gaim_signal_register(handle, "conversation-drag-ended", |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6142 gaim_marshal_VOID__POINTER_POINTER, NULL, 2, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6143 gaim_value_new(GAIM_TYPE_SUBTYPE, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6144 GAIM_SUBTYPE_CONV_WINDOW), |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6145 gaim_value_new(GAIM_TYPE_SUBTYPE, |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6146 GAIM_SUBTYPE_CONV_WINDOW)); |
9167 | 6147 |
6148 /********************************************************************** | |
6149 * Register commands | |
6150 **********************************************************************/ | |
9213 | 6151 gaim_cmd_register("me", "S", GAIM_CMD_P_DEFAULT, |
6152 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, | |
9247 | 6153 me_command_cb, _("me <action>: Send an IRC style action to a buddy or chat.")); |
9213 | 6154 gaim_cmd_register("debug", "w", GAIM_CMD_P_DEFAULT, |
6155 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, | |
9247 | 6156 debug_command_cb, _("debug <option>: Send various debug information to the current conversation.")); |
9213 | 6157 |
6158 gaim_cmd_register("help", "", GAIM_CMD_P_DEFAULT, | |
6159 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, | |
9247 | 6160 help_command_cb, _("help: List available commands.")); |
9213 | 6161 |
6162 gaim_cmd_register("help", "w", GAIM_CMD_P_DEFAULT, | |
6163 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, | |
9247 | 6164 help_arg_command_cb, _("help <command>: Help on a specific command.")); |
5673
62f57ec16f29
[gaim-migrate @ 6091]
Christian Hammond <chipx86@chipx86.com>
parents:
5629
diff
changeset
|
6165 } |
8582
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6166 |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6167 void |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6168 gaim_gtk_conversations_uninit(void) |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6169 { |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6170 gaim_signals_unregister_by_instance(gaim_gtk_conversations_get_handle()); |
d7c85220c685
[gaim-migrate @ 9332]
Christian Hammond <chipx86@chipx86.com>
parents:
8573
diff
changeset
|
6171 } |