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