annotate src/conversation.c @ 79:bfdc427b936d

[gaim-migrate @ 89] I'll save time and just post the email :-) Summary of changes: * Misc malloc/free cleanups, use g_malloc more places and other small stuff (e.g. lineardata not being freed in the error case in sound.c) * Misc signed/unsigned cleanups (use size_t more often) * read() can return -1 at any point, check return values more rigorously (read_rv variables used for this) * In can_play_audio, stat requires a pointer to an allocated stat_buf (the address of an automatic variable) * escape_text needs a buffer at least 4 times the size of the text being passed in (not 2 times); I can force core dumps with lots of newlines otherwise * There's a debug statement in netscape_command (browser.c) that was printf("Hello%d\n"); with no int for the %d; I threw in a getppid(), but the statement should probably come out eventually. Thanks, G Sumner Hayes! committer: Tailor Script <tailor@pidgin.im>
author Rob Flynn <gaim@robflynn.com>
date Wed, 05 Apr 2000 05:34:08 +0000
parents dead1eb6d654
children 7a24bb75a97b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1 /*
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2 * gaim
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3 *
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
5 *
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
9 * (at your option) any later version.
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
10 *
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
14 * GNU General Public License for more details.
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
15 *
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
19 *
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
20 */
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
21
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
22 #include <string.h>
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
23 #include <sys/time.h>
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
24 #include <sys/types.h>
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
25 #include <sys/stat.h>
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
26 #include <unistd.h>
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
27 #include <stdio.h>
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
28 #include <stdlib.h>
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
29 #include <gtk/gtk.h>
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
30 #include "gaim.h"
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
31 #include "gtkhtml.h"
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
32 #include <gdk/gdkkeysyms.h>
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
33 #include "pixmaps/underline.xpm"
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
34 #include "pixmaps/bold.xpm"
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
35 #include "pixmaps/italic.xpm"
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
36 #include "pixmaps/small.xpm"
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
37 #include "pixmaps/normal.xpm"
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
38 #include "pixmaps/big.xpm"
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
39 #include "pixmaps/speaker.xpm"
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
40 #include "pixmaps/aimicon2.xpm"
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
41 #include "pixmaps/wood.xpm"
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
42 #include "pixmaps/palette.xpm"
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
43 #include "pixmaps/link.xpm"
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
44 #include "pixmaps/strike.xpm"
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
45
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
46 int state_lock=0;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
47
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
48 GdkPixmap *dark_icon_pm = NULL;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
49 GdkBitmap *dark_icon_bm = NULL;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
50
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
51
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
52 void check_everything(GtkWidget *entry);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
53 gboolean user_keypress_callback(GtkWidget *entry, GdkEventKey *event, struct conversation *c);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
54
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
55
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
56 /*------------------------------------------------------------------------*/
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
57 /* Helpers */
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
58 /*------------------------------------------------------------------------*/
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
59
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
60
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
61 void quiet_set(GtkWidget *tb, int state)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
62 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
63 state_lock=1;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
64 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(tb), state);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
65 state_lock=0;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
66 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
67
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
68
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
69 void set_state_lock(int i)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
70 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
71 state_lock = i;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
72 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
73
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
74 struct conversation *new_conversation(char *name)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
75 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
76 struct conversation *c;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
77
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
78 c = find_conversation(name);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
79
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
80 if (c != NULL)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
81 return c;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
82
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
83 c = (struct conversation *)g_new0(struct conversation, 1);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
84 g_snprintf(c->name, sizeof(c->name), "%s", name);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
85
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
86 if ((general_options & OPT_GEN_LOG_ALL) || find_log_info(c->name)) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
87 FILE *fd;
70
dead1eb6d654 [gaim-migrate @ 80]
Rob Flynn <gaim@robflynn.com>
parents: 68
diff changeset
88
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
89 fd = open_log_file(c);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
90 if (!(general_options & OPT_GEN_STRIP_HTML))
70
dead1eb6d654 [gaim-migrate @ 80]
Rob Flynn <gaim@robflynn.com>
parents: 68
diff changeset
91 fprintf(fd, "<HR><BR><H3 Align=Center> ---- New Conversation @ %s ----</H3><BR>\n", full_date());
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
92 else
70
dead1eb6d654 [gaim-migrate @ 80]
Rob Flynn <gaim@robflynn.com>
parents: 68
diff changeset
93 fprintf(fd, " ---- New Conversation @ %s ----\n", full_date());
dead1eb6d654 [gaim-migrate @ 80]
Rob Flynn <gaim@robflynn.com>
parents: 68
diff changeset
94
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
95 fclose(fd);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
96 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
97
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
98 show_conv(c);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
99 conversations = g_list_append(conversations, c);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
100 return c;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
101 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
102
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
103
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
104 struct conversation *find_conversation(char *name)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
105 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
106 char *cuser = g_malloc(64);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
107 struct conversation *c;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
108 GList *cnv = conversations;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
109
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
110 strcpy(cuser, normalize(name));
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
111
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
112 while(cnv) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
113 c = (struct conversation *)cnv->data;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
114 if(!strcasecmp(cuser, normalize(c->name))) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
115 g_free(cuser);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
116 return c;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
117 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
118 cnv = cnv->next;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
119 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
120 g_free(cuser);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
121 return NULL;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
122 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
123
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
124 /* ---------------------------------------------------
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
125 * Function to remove a log file entry
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
126 * ---------------------------------------------------
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
127 */
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
128
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
129 void rm_log(struct log_conversation *a)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
130 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
131 struct conversation *cnv = find_conversation(a->name);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
132 char buf[128];
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
133
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
134 log_conversations = g_list_remove(log_conversations, a);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
135
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
136 save_prefs();
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
137
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
138 if (cnv) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
139 if (!(general_options & OPT_GEN_LOG_ALL))
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
140 g_snprintf(buf, sizeof(buf), CONVERSATION_TITLE, cnv->name);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
141 else
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
142 g_snprintf(buf, sizeof(buf), LOG_CONVERSATION_TITLE, cnv->name);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
143 gtk_window_set_title(GTK_WINDOW(cnv->window), buf);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
144 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
145 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
146
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
147 struct log_conversation *find_log_info(char *name)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
148 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
149 char *pname = g_malloc(64);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
150 GList *lc = log_conversations;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
151 struct log_conversation *l;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
152
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
153
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
154 strcpy(pname, normalize(name));
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
155
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
156 while(lc) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
157 l = (struct log_conversation *)lc->data;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
158 if (!strcasecmp(pname, normalize(l->name))) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
159 g_free(pname);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
160 return l;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
161 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
162 lc = lc->next;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
163 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
164 g_free(pname);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
165 return NULL;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
166 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
167
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
168 void delete_conversation(struct conversation *cnv)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
169 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
170 conversations = g_list_remove(conversations, cnv);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
171 g_free(cnv);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
172 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
173
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
174 void update_log_convs()
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
175 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
176 GList *cnv = conversations;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
177 struct conversation *c;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
178
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
179 while(cnv) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
180 c = (struct conversation *)cnv->data;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
181
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
182 if (c->log_button)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
183 gtk_widget_set_sensitive(c->log_button, ((general_options & OPT_GEN_LOG_ALL)) ? FALSE : TRUE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
184
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
185 cnv = cnv->next;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
186 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
187 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
188
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
189 void update_font_buttons()
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
190 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
191 GList *cnv = conversations;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
192 struct conversation *c;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
193
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
194 while (cnv) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
195 c = (struct conversation *)cnv->data;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
196
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
197 if (c->bold)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
198 gtk_widget_set_sensitive(c->bold, ((font_options & OPT_FONT_BOLD)) ? FALSE : TRUE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
199
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
200 if (c->italic)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
201 gtk_widget_set_sensitive(c->italic, ((font_options & OPT_FONT_ITALIC)) ? FALSE : TRUE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
202
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
203 if (c->underline)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
204 gtk_widget_set_sensitive(c->underline, ((font_options & OPT_FONT_UNDERLINE)) ? FALSE : TRUE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
205
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
206 if (c->strike)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
207 gtk_widget_set_sensitive(c->strike, ((font_options & OPT_FONT_STRIKE)) ? FALSE : TRUE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
208
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
209 cnv = cnv->next;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
210 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
211 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
212
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
213 /*
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
214 void update_transparency()
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
215 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
216 GList *cnv = conversations;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
217 struct conversation *c;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
218
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
219 This func should be uncalled!
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
220
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
221 while(cnv) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
222 c = (struct conversation *)cnv->data;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
223
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
224 if (c->text)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
225 gtk_html_set_transparent(GTK_HTML(c->text),
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
226 (transparent) ? TRUE : FALSE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
227
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
228 cnv = cnv->next;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
229 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
230 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
231 */
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
232
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
233
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
234 /*------------------------------------------------------------------------*/
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
235 /* Callbacks */
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
236 /*------------------------------------------------------------------------*/
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
237
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
238 void toggle_loggle(GtkWidget *w, struct conversation *p)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
239 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
240 if (state_lock)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
241 return;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
242
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
243 if (find_log_info(p->name))
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
244 rm_log(find_log_info(p->name));
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
245 else
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
246 show_log_dialog(p->name);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
247 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
248
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
249
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
250 static int close_callback(GtkWidget *widget, struct conversation *c)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
251 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
252 gtk_widget_destroy(c->window);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
253 delete_conversation(c);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
254 return TRUE;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
255 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
256
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
257 static gint delete_event_convo(GtkWidget *w, GdkEventAny *e, struct conversation *c)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
258 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
259 delete_conversation(c);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
260 return FALSE;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
261 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
262
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
263
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
264 static void color_callback(GtkWidget *widget, struct conversation *c)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
265 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
266 /* show_color_dialog(c); */
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
267 gtk_widget_grab_focus(c->entry);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
268 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
269
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
270 static void add_callback(GtkWidget *widget, struct conversation *c)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
271 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
272 if (find_buddy(c->name) != NULL) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
273 sprintf(debug_buff,"Removing '%s' from buddylist.\n", c->name);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
274 debug_print(debug_buff);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
275 remove_buddy(find_group_by_buddy(c->name), find_buddy(c->name));
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
276 build_edit_tree();
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
277 gtk_label_set_text(GTK_LABEL(GTK_BIN(c->add_button)->child), "Add");
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
278 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
279 else
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
280 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
281 show_add_buddy(c->name, NULL);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
282 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
283
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
284 gtk_widget_grab_focus(c->entry);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
285 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
286
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
287
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
288 static void block_callback(GtkWidget *widget, struct conversation *c)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
289 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
290 show_add_perm(c->name);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
291 gtk_widget_grab_focus(c->entry);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
292 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
293
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
294 static void warn_callback(GtkWidget *widget, struct conversation *c)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
295 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
296 show_warn_dialog(c->name);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
297 gtk_widget_grab_focus(c->entry);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
298 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
299
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
300 static void info_callback(GtkWidget *widget, struct conversation *c)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
301 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
302 serv_get_info(c->name);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
303 gtk_widget_grab_focus(c->entry);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
304 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
305
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
306 gboolean user_keypress_callback(GtkWidget *entry, GdkEventKey *event, struct conversation *c)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
307 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
308 int pos;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
309 if(event->keyval==GDK_Return) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
310 if(!(event->state & GDK_SHIFT_MASK)){
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
311 gtk_signal_emit_by_name(GTK_OBJECT(entry), "activate", c);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
312 //to stop the putting in of the enter character
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
313 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
314 } else {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
315 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
316 pos=gtk_editable_get_position(GTK_EDITABLE(entry));
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
317 gtk_editable_insert_text(GTK_EDITABLE(entry), "\n", 1, &pos);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
318 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
319 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
320
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
321 return TRUE;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
322
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
323 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
324
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
325
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
326 static void send_callback(GtkWidget *widget, struct conversation *c)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
327 {
79
bfdc427b936d [gaim-migrate @ 89]
Rob Flynn <gaim@robflynn.com>
parents: 70
diff changeset
328 char buf[BUF_LEN*4];
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
329 char *buf2;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
330 gchar *buf4;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
331 int hdrlen;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
332
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
333 buf4 = gtk_editable_get_chars(GTK_EDITABLE(c->entry), 0, -1);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
334 g_snprintf(buf, BUF_LONG, "%s", buf4);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
335 g_free(buf4);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
336
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
337 if (!strlen(buf)) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
338 return;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
339 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
340
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
341 if (general_options & OPT_GEN_SEND_LINKS) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
342 linkify_text(buf);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
343 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
344
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
345 /* Let us determine how long the message CAN be.
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
346 * toc_send_im is 11 chars long + 2 quotes.
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
347 * + 2 spaces + 6 for the header + 2 for good
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
348 * measure = 23 bytes + the length of normalize c->name */
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
349
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
350 buf2 = g_malloc(BUF_LONG);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
351
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
352 hdrlen = 23 + strlen(normalize(c->name));
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
353
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
354 /* printf("%d %d %d\n", strlen(buf), hdrlen, BUF_LONG);*/
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
355
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
356 if (font_options & OPT_FONT_BOLD) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
357 g_snprintf(buf2, BUF_LONG, "<B>%s</B>", buf);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
358 strcpy(buf, buf2);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
359 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
360
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
361 if (font_options & OPT_FONT_ITALIC) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
362 g_snprintf(buf2, BUF_LONG, "<I>%s</I>", buf);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
363 strcpy(buf, buf2);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
364 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
365
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
366 if (font_options & OPT_FONT_UNDERLINE) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
367 g_snprintf(buf2, BUF_LONG, "<U>%s</U>", buf);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
368 strcpy(buf, buf2);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
369 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
370
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
371 if (font_options & OPT_FONT_STRIKE) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
372 g_snprintf(buf2, BUF_LONG, "<STRIKE>%s</STRIKE>", buf);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
373 strcpy(buf, buf2);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
374 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
375
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
376 write_to_conv(c, buf, WFLAG_SEND);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
377
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
378 gtk_editable_delete_text(GTK_EDITABLE(c->entry), 0, -1);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
379
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
380 escape_text(buf);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
381 if (escape_message(buf) > MSG_LEN - hdrlen) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
382 do_error_dialog("Message too long, some data truncated.", "Error");
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
383 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
384
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
385 serv_send_im(c->name, buf, 0);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
386
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
387 quiet_set(c->bold, FALSE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
388 quiet_set(c->strike, FALSE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
389 quiet_set(c->italic, FALSE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
390 quiet_set(c->underline, FALSE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
391 quiet_set(c->palette, FALSE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
392 quiet_set(c->link, FALSE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
393
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
394 if (c->makesound && (sound_options & OPT_SOUND_SEND))
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
395 play_sound(SEND);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
396
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
397 if (awaymessage != NULL) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
398 do_im_back();
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
399 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
400
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
401
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
402 gtk_widget_grab_focus(c->entry);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
403
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
404 g_free(buf2);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
405
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
406 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
407
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
408 static int
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
409 entry_key_pressed(GtkWidget *w, GtkWidget *entry)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
410 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
411 check_everything(w);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
412 return TRUE;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
413 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
414
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
415 /*------------------------------------------------------------------------*/
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
416 /* HTML-type stuff */
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
417 /*------------------------------------------------------------------------*/
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
418
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
419 int count_tag(GtkWidget *entry, char *s1, char *s2)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
420 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
421 char *p1, *p2;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
422 int res=0;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
423 char *tmp, *tmpo, h;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
424 tmpo = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
425 h = tmpo[GTK_EDITABLE(entry)->current_pos];
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
426 tmpo[GTK_EDITABLE(entry)->current_pos]='\0';
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
427 tmp=tmpo;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
428 do {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
429 p1 = strstr(tmp, s1);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
430 p2 = strstr(tmp, s2);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
431 if (p1 && p2) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
432 if (p1 < p2) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
433 res=1;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
434 tmp = p1 +strlen(s1);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
435 } else if (p2 < p1) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
436 res = 0;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
437 tmp = p2 + strlen(s2);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
438 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
439 } else {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
440 if (p1) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
441 res = 1;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
442 tmp = p1 + strlen(s1);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
443 } else if (p2) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
444 res = 0;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
445 tmp = p2 + strlen(s2);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
446 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
447 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
448 } while (p1 || p2);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
449 tmpo[GTK_EDITABLE(entry)->current_pos]=h;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
450 g_free(tmpo);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
451 return res;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
452 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
453
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
454
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
455 int invert_tags(GtkWidget *entry, char *s1, char *s2, int really)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
456 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
457 int start = GTK_EDITABLE(entry)->selection_start_pos;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
458 int finish = GTK_EDITABLE(entry)->selection_end_pos;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
459 char *s;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
460
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
461 s = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
462 if (!strncasecmp(&s[start], s1, strlen(s1)) &&
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
463 !strncasecmp(&s[finish - strlen(s2)], s2, strlen(s2))) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
464 if (really) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
465 gtk_editable_delete_text(GTK_EDITABLE(entry), start, start + strlen(s1));
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
466 gtk_editable_delete_text(GTK_EDITABLE(entry), finish - strlen(s2) - strlen(s1), finish - strlen(s1));
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
467 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
468 g_free(s);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
469 return 1;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
470 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
471 g_free(s);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
472 return 0;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
473 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
474
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
475
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
476 void remove_tags(GtkWidget *entry, char *tag)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
477 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
478 char *s;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
479 char *t;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
480 int start = GTK_EDITABLE(entry)->selection_start_pos;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
481 int finish = GTK_EDITABLE(entry)->selection_end_pos;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
482 s = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
483 t = s;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
484 while((t = strstr(t, tag))) {
68
03ec647d24e9 [gaim-migrate @ 78]
Rob Flynn <gaim@robflynn.com>
parents: 67
diff changeset
485 if (((t-s) < finish) && ((t-s) >= start)) {
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
486 gtk_editable_delete_text(GTK_EDITABLE(entry), (t-s), (t-s) + strlen(tag));
68
03ec647d24e9 [gaim-migrate @ 78]
Rob Flynn <gaim@robflynn.com>
parents: 67
diff changeset
487 }
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
488 else t++;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
489 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
490 g_free(s);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
491 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
492
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
493 void surround(GtkWidget *entry, char *pre, char *post)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
494 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
495 int pos = GTK_EDITABLE(entry)->current_pos;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
496 int dummy;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
497 int start, finish;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
498 if (GTK_EDITABLE(entry)->has_selection) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
499 remove_tags(entry, pre);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
500 remove_tags(entry, post);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
501 start = GTK_EDITABLE(entry)->selection_start_pos;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
502 finish = GTK_EDITABLE(entry)->selection_end_pos;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
503 if (start > finish) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
504 dummy = finish;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
505 finish = start;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
506 start = dummy;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
507 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
508 dummy = start;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
509 gtk_editable_insert_text(GTK_EDITABLE(entry), pre, strlen(pre), &dummy);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
510 dummy = finish + strlen(pre);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
511 gtk_editable_insert_text(GTK_EDITABLE(entry), post, strlen(post), &dummy);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
512 gtk_editable_select_region(GTK_EDITABLE(entry), start, finish + strlen(pre) + strlen(post));
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
513 } else {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
514 gtk_editable_insert_text(GTK_EDITABLE(entry), pre, strlen(pre), &pos);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
515 dummy = pos;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
516 gtk_editable_insert_text(GTK_EDITABLE(entry), post, strlen(post), &dummy);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
517 gtk_editable_set_position(GTK_EDITABLE(entry), pos);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
518 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
519 gtk_widget_grab_focus(entry);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
520 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
521
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
522 static void advance_past(GtkWidget *entry, char *pre, char *post)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
523 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
524 char *s, *s2;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
525 int pos;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
526 if (invert_tags(entry, pre, post, 1))
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
527 return;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
528 s = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
529 pos = GTK_EDITABLE(entry)->current_pos;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
530 sprintf(debug_buff,"Currently at %d\n",pos);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
531 debug_print(debug_buff);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
532 s2= strstr(&s[pos], post);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
533 if (s2)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
534 pos = s2 - s + strlen(post);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
535 else
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
536 pos=-1;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
537 sprintf(debug_buff,"Setting position to %d\n",pos);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
538 debug_print(debug_buff);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
539 gtk_editable_set_position(GTK_EDITABLE(entry), pos);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
540 gtk_widget_grab_focus(entry);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
541 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
542
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
543 static void toggle_color(GtkWidget *color, GtkWidget *entry)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
544 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
545 if (state_lock)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
546 return;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
547 if (GTK_TOGGLE_BUTTON(color)->active)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
548 show_color_dialog(entry, color);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
549 else
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
550 advance_past(entry, "<FONT COLOR>", "</FONT>");
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
551 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
552
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
553 static void do_link(GtkWidget *linky, GtkWidget *entry)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
554 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
555 if (state_lock)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
556 return;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
557 if (GTK_TOGGLE_BUTTON(linky)->active)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
558 show_add_link(entry, linky);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
559 else
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
560 advance_past(entry, "<A HREF>", "</A>" );
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
561 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
562
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
563 static void do_strike(GtkWidget *strike, GtkWidget *entry)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
564 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
565 if (state_lock)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
566 return;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
567 if (GTK_TOGGLE_BUTTON(strike)->active)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
568 surround(entry, "<STRIKE>","</STRIKE>");
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
569 else
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
570 advance_past(entry, "<STRIKE>", "</STRIKE>");
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
571 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
572
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
573 static void do_bold(GtkWidget *bold, GtkWidget *entry)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
574 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
575 if (state_lock)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
576 return;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
577 if (GTK_TOGGLE_BUTTON(bold)->active)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
578 surround(entry, "<B>","</B>");
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
579 else
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
580 advance_past(entry, "<B>", "</B>");
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
581 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
582
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
583 static void do_underline(GtkWidget *underline, GtkWidget *entry)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
584 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
585 if (state_lock)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
586 return;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
587 if (GTK_TOGGLE_BUTTON(underline)->active)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
588 surround(entry, "<U>","</U>");
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
589 else
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
590 advance_past(entry, "<U>", "</U>");
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
591 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
592
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
593 static void do_italic(GtkWidget *italic, GtkWidget *entry)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
594 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
595 if (state_lock)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
596 return;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
597 if (GTK_TOGGLE_BUTTON(italic)->active)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
598 surround(entry, "<I>","</I>");
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
599 else
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
600 advance_past(entry, "<I>", "</I>");
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
601 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
602
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
603 static void do_small(GtkWidget *small, GtkWidget *entry)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
604 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
605 if (state_lock)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
606 return;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
607 surround(entry, "<FONT SIZE=\"+1\">","</FONT>");
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
608 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
609
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
610 static void do_normal(GtkWidget *normal, GtkWidget *entry)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
611 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
612 if (state_lock)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
613 return;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
614 surround(entry, "<FONT SIZE=\"+3\">","</FONT>");
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
615 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
616
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
617 static void do_big(GtkWidget *big, GtkWidget *entry)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
618 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
619 if (state_lock)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
620 return;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
621 surround(entry, "<FONT SIZE=\"+5\">","</FONT>");
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
622 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
623
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
624 void check_everything(GtkWidget *entry)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
625 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
626 struct conversation *c;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
627 c = (struct conversation *)gtk_object_get_user_data(GTK_OBJECT(entry));
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
628 if (!c) return;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
629 if (invert_tags(entry, "<B>", "</B>", 0))
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
630 quiet_set(c->bold, TRUE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
631 else if (count_tag(entry, "<B>", "</B>"))
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
632 quiet_set(c->bold, TRUE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
633 else
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
634 quiet_set(c->bold,FALSE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
635 if (invert_tags(entry, "<I>", "</I>", 0))
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
636 quiet_set(c->italic, TRUE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
637 else if (count_tag(entry, "<I>", "</I>"))
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
638 quiet_set(c->italic, TRUE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
639 else
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
640 quiet_set(c->italic, FALSE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
641
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
642 if (invert_tags(entry, "<FONT COLOR", "</FONT>", 0))
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
643 quiet_set(c->palette, TRUE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
644 else if (count_tag(entry, "<FONT COLOR", "</FONT>"))
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
645 quiet_set(c->palette, TRUE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
646 else
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
647 quiet_set(c->palette, FALSE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
648
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
649 if (invert_tags(entry, "<A HREF", "</A>", 0))
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
650 quiet_set(c->link, TRUE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
651 else if (count_tag(entry, "<A HREF", "</A>"))
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
652 quiet_set(c->link, TRUE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
653 else
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
654 quiet_set(c->link, FALSE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
655
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
656 if (invert_tags(entry, "<U>", "</U>", 0))
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
657 quiet_set(c->underline, TRUE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
658 else if (count_tag(entry, "<U>", "</U>"))
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
659 quiet_set(c->underline, TRUE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
660 else
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
661 quiet_set(c->underline, FALSE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
662
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
663 if (invert_tags(entry, "<STRIKE>", "</STRIKE>", 0))
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
664 quiet_set(c->strike, TRUE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
665 else if (count_tag(entry, "<STRIKE>", "</STRIKE>"))
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
666 quiet_set(c->strike, TRUE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
667 else
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
668 quiet_set(c->strike, FALSE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
669 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
670
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
671
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
672 /*------------------------------------------------------------------------*/
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
673 /* Takin care of the window.. */
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
674 /*------------------------------------------------------------------------*/
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
675
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
676
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
677 void write_to_conv(struct conversation *c, char *what, int flags)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
678 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
679 char *buf = g_malloc(BUF_LONG);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
680 char *buf2 = g_malloc(BUF_LONG);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
681 char *who = NULL;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
682 FILE *fd;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
683 char colour[10];
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
684
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
685 if (flags & WFLAG_SYSTEM) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
686
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
687 gtk_html_freeze(GTK_HTML(c->text));
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
688
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
689 gtk_html_append_text(GTK_HTML(c->text), what, 0);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
690
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
691 gtk_html_append_text(GTK_HTML(c->text), "<BR>", 0);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
692
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
693 gtk_html_thaw(GTK_HTML(c->text));
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
694
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
695
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
696 if ((general_options & OPT_GEN_LOG_ALL) || find_log_info(c->name)) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
697 char *t1;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
698
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
699 if (general_options & OPT_GEN_STRIP_HTML) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
700 t1 = strip_html(what);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
701 } else {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
702 t1 = what;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
703 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
704 fd = open_log_file(c);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
705 fprintf(fd, "%s\n", t1);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
706 fclose(fd);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
707 if (general_options & OPT_GEN_STRIP_HTML) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
708 g_free(t1);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
709 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
710 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
711
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
712 } else {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
713
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
714 if (flags & WFLAG_RECV) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
715 strcpy(colour, "#ff0000");
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
716 who = c->name;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
717 } else if (flags & WFLAG_SEND) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
718 strcpy(colour, "#0000ff");
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
719 who = current_user->username;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
720 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
721
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
722 if (flags & WFLAG_AUTO && flags & WFLAG_SEND)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
723 sprintf(buf2, " %s", AUTO_RESPONSE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
724 else
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
725 buf2[0]=0; /* sprintf(buf2, ""); */
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
726
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
727 if (display_options & OPT_DISP_SHOW_TIME)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
728 g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"%s\"><B>%s %s:%s</B></FONT> ", colour, date(), who, buf2);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
729 else
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
730 g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"%s\"><B>%s:%s</B></FONT> ", colour, who, buf2);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
731
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
732 gtk_html_freeze(GTK_HTML(c->text));
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
733
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
734 gtk_html_append_text(GTK_HTML(c->text), buf, 0);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
735 gtk_html_append_text(GTK_HTML(c->text), what, (display_options & OPT_DISP_IGNORE_COLOUR) ? HTML_OPTION_NO_COLOURS : 0);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
736
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
737 gtk_html_append_text(GTK_HTML(c->text), "<BR>", 0);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
738
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
739
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
740 gtk_html_thaw(GTK_HTML(c->text));
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
741
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
742 if ((general_options & OPT_GEN_LOG_ALL) || find_log_info(c->name)) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
743 char *t1, *t2;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
744
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
745 if (general_options & OPT_GEN_STRIP_HTML) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
746 t1 = strip_html(buf);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
747 t2 = strip_html(what);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
748 } else {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
749 t1 = buf;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
750 t2 = what;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
751 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
752 fd = open_log_file(c);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
753 fprintf(fd, "%s%s\n", t1, t2);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
754 fclose(fd);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
755 if (general_options & OPT_GEN_STRIP_HTML) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
756 g_free(t1);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
757 g_free(t2);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
758 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
759 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
760 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
761
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
762 /* if (!GTK_WIDGET_MAPPED(c->window)) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
763
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
764 if (dark_icon_pm == NULL)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
765 dark_icon_pm = gdk_pixmap_create_from_xpm_d(c->window->window, &dark_icon_bm,
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
766 NULL, (gchar **)aimicon2_xpm);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
767 gdk_window_set_icon(c->window->window, NULL, dark_icon_pm, dark_icon_bm);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
768 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
769 */
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
770
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
771 if (general_options & OPT_GEN_POPUP_WINDOWS)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
772 gdk_window_raise(c->window->window);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
773
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
774
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
775 g_free(buf);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
776 g_free(buf2);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
777 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
778
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
779
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
780
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
781
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
782
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
783 void show_conv(struct conversation *c)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
784 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
785 GtkWidget *win;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
786 char buf[256];
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
787 GtkWidget *text;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
788 GtkWidget *sw;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
789 GtkWidget *send;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
790 GtkWidget *info;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
791 GtkWidget *warn;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
792 GtkWidget *block;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
793 GtkWidget *color;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
794 GtkWidget *close;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
795 GtkWidget *entry;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
796 GtkWidget *toolbar;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
797 GtkWidget *bbox;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
798 GtkWidget *vbox;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
799 GtkWidget *add;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
800 GdkPixmap *strike_i, *small_i, *normal_i, *big_i, *bold_i, *italic_i, *underline_i, *speaker_i, *wood_i, *palette_i, *link_i;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
801 GtkWidget *strike_p, *small_p, *normal_p, *big_p, *bold_p, *italic_p, *underline_p, *speaker_p, *wood_p, *palette_p, *link_p;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
802 GtkWidget *strike, *small, *normal, *big, *bold, *italic, *underline, *speaker, *wood, *palette, *link;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
803 GdkBitmap *mask;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
804
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
805 win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
806 gtk_window_set_policy(GTK_WINDOW(win), TRUE, TRUE, TRUE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
807
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
808 gtk_widget_realize(win);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
809 aol_icon(win->window);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
810
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
811
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
812 c->window = win;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
813
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
814 send = gtk_button_new_with_label("Send");
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
815 info = gtk_button_new_with_label("Info");
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
816 warn = gtk_button_new_with_label("Warn");
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
817 color = gtk_button_new_with_label("Color");
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
818 close = gtk_button_new_with_label("Close");
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
819 if (find_buddy(c->name) != NULL) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
820 add = gtk_button_new_with_label("Remove");
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
821 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
822 else {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
823 add = gtk_button_new_with_label("Add");
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
824 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
825 block = gtk_button_new_with_label("Block");
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
826
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
827
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
828 bbox = gtk_hbox_new(TRUE, 0);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
829 vbox = gtk_vbox_new(FALSE, 0);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
830
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
831 entry = gtk_text_new(NULL, NULL);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
832 gtk_text_set_editable(GTK_TEXT(entry), TRUE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
833 gtk_text_set_word_wrap(GTK_TEXT(entry), TRUE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
834
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
835 /* Toolbar */
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
836 toolbar = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_ICONS);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
837
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
838 link_i = gdk_pixmap_create_from_xpm_d(win->window, &mask,
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
839 &win->style->white, link_xpm );
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
840 link_p = gtk_pixmap_new(link_i, mask);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
841 gtk_widget_show(link_p);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
842
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
843 palette_i = gdk_pixmap_create_from_xpm_d (win->window, &mask,
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
844 &win->style->white, palette_xpm );
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
845 palette_p = gtk_pixmap_new(palette_i, mask);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
846 gtk_widget_show(palette_p);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
847
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
848 wood_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask,
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
849 &win->style->white, wood_xpm );
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
850 wood_p = gtk_pixmap_new(wood_i, mask);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
851 gtk_widget_show(wood_p);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
852 speaker_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask,
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
853 &win->style->white, speaker_xpm );
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
854 speaker_p = gtk_pixmap_new(speaker_i, mask);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
855 gtk_widget_show(speaker_p);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
856 c->makesound=1;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
857 strike_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask,
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
858 &win->style->white, strike_xpm );
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
859 strike_p = gtk_pixmap_new(strike_i, mask);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
860 gtk_widget_show(strike_p);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
861 bold_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask,
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
862 &win->style->white, bold_xpm );
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
863 bold_p = gtk_pixmap_new(bold_i, mask);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
864 gtk_widget_show(bold_p);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
865 italic_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask,
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
866 &win->style->white, italic_xpm );
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
867 italic_p = gtk_pixmap_new(italic_i, mask);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
868 gtk_widget_show(italic_p);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
869 underline_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask,
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
870 &win->style->white, underline_xpm );
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
871 underline_p = gtk_pixmap_new(underline_i, mask);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
872 gtk_widget_show(underline_p);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
873 small_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask,
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
874 &win->style->white, small_xpm );
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
875 small_p = gtk_pixmap_new(small_i, mask);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
876 gtk_widget_show(small_p);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
877 normal_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask,
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
878 &win->style->white, normal_xpm );
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
879 normal_p = gtk_pixmap_new(normal_i, mask);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
880 gtk_widget_show(normal_p);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
881 big_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask,
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
882 &win->style->white, big_xpm );
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
883 big_p = gtk_pixmap_new(big_i, mask);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
884 gtk_widget_show(big_p);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
885
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
886
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
887 bold = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
888 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, NULL,
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
889 "Bold", "Bold Text", "Bold", bold_p,
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
890 GTK_SIGNAL_FUNC(do_bold), entry);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
891 italic = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
892 GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
893 NULL, "Italics", "Italics Text",
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
894 "Italics", italic_p, GTK_SIGNAL_FUNC(do_italic), entry);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
895 underline = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
896 GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
897 NULL, "Underline", "Underline Text",
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
898 "Underline", underline_p, GTK_SIGNAL_FUNC(do_underline), entry);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
899 strike = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
900 GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
901 NULL, "Strike", "Strike through Text",
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
902 "Strike", strike_p, GTK_SIGNAL_FUNC(do_strike), entry);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
903 gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
904 small = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), "Small", "Decrease font size", "Small", small_p, GTK_SIGNAL_FUNC(do_small), entry);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
905 normal = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), "Normal", "Normal font size", "Normal", normal_p, GTK_SIGNAL_FUNC(do_normal), entry);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
906 big = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), "Big", "Increase font size", "Big", big_p, GTK_SIGNAL_FUNC(do_big), entry);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
907 gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
908 link = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
909 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, NULL, "Link", "Insert Link",
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
910 "Link", link_p, GTK_SIGNAL_FUNC(do_link), entry);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
911 palette = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
912 GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
913 NULL, "Color", "Text Color",
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
914 "Color", palette_p, GTK_SIGNAL_FUNC(toggle_color), entry);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
915 wood = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
916 GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
917 NULL, "Logging", "Enable logging",
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
918 "Logging", wood_p, GTK_SIGNAL_FUNC(toggle_loggle), c);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
919 speaker = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
920 GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
921 NULL, "Sound", "Enable sounds",
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
922 "Sound", speaker_p, GTK_SIGNAL_FUNC(set_option), &c->makesound);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
923 c->makesound=0;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
924 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(speaker), TRUE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
925
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
926 state_lock = 1;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
927 if (find_log_info(c->name))
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
928 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(wood), TRUE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
929 else
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
930 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(wood), FALSE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
931 state_lock = 0;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
932
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
933 gtk_widget_show(toolbar);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
934
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
935 c->entry = entry;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
936 c->bold = bold;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
937 c->strike = strike;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
938 c->italic = italic;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
939 c->underline = underline;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
940 c->log_button = wood;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
941 c->palette = palette;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
942 c->link = link;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
943 c->add_button = add;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
944
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
945 gtk_widget_set_sensitive(c->log_button, ((general_options & OPT_GEN_LOG_ALL)) ? FALSE : TRUE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
946
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
947 gtk_widget_set_sensitive(c->bold, ((font_options & OPT_FONT_BOLD)) ? FALSE : TRUE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
948 gtk_widget_set_sensitive(c->italic, ((font_options & OPT_FONT_ITALIC)) ? FALSE : TRUE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
949 gtk_widget_set_sensitive(c->underline, ((font_options & OPT_FONT_UNDERLINE)) ? FALSE : TRUE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
950 gtk_widget_set_sensitive(c->strike, ((font_options & OPT_FONT_STRIKE)) ? FALSE : TRUE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
951
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
952 gtk_object_set_user_data(GTK_OBJECT(entry), c);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
953
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
954
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
955
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
956 gtk_signal_connect(GTK_OBJECT(entry), "activate", GTK_SIGNAL_FUNC(send_callback),c);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
957
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
958 /* Text box */
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
959
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
960
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
961 text = gtk_html_new(NULL, NULL);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
962
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
963 gtk_html_set_editable(GTK_HTML(text), FALSE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
964 /* gtk_html_set_transparent(GTK_HTML(text), (transparent) ? TRUE : FALSE);*/
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
965 c->text = text;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
966
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
967 sw = gtk_scrolled_window_new (NULL, NULL);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
968 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
969 GTK_POLICY_NEVER,
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
970 GTK_POLICY_ALWAYS);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
971 gtk_widget_show(sw);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
972 gtk_container_add(GTK_CONTAINER(sw), text);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
973 gtk_widget_show(text);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
974
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
975
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
976
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
977
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
978 GTK_HTML (text)->hadj->step_increment = 10.0;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
979 GTK_HTML (text)->vadj->step_increment = 10.0;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
980 gtk_widget_set_usize(sw, 320, 150);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
981
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
982
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
983
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
984 /* Ready and pack buttons */
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
985 gtk_object_set_user_data(GTK_OBJECT(win), c);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
986 gtk_object_set_user_data(GTK_OBJECT(close), c);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
987 gtk_signal_connect(GTK_OBJECT(close), "clicked", GTK_SIGNAL_FUNC(close_callback), c);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
988 gtk_signal_connect(GTK_OBJECT(send), "clicked", GTK_SIGNAL_FUNC(send_callback), c);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
989 gtk_signal_connect(GTK_OBJECT(add), "clicked", GTK_SIGNAL_FUNC(add_callback), c);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
990 gtk_signal_connect(GTK_OBJECT(info), "clicked", GTK_SIGNAL_FUNC(info_callback), c);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
991 gtk_signal_connect(GTK_OBJECT(warn), "clicked", GTK_SIGNAL_FUNC(warn_callback), c);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
992 gtk_signal_connect(GTK_OBJECT(block), "clicked", GTK_SIGNAL_FUNC(block_callback), c);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
993 gtk_signal_connect(GTK_OBJECT(color), "clicked", GTK_SIGNAL_FUNC(color_callback), c);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
994
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
995 gtk_signal_connect(GTK_OBJECT(entry), "key_press_event", GTK_SIGNAL_FUNC(user_keypress_callback), c);
68
03ec647d24e9 [gaim-migrate @ 78]
Rob Flynn <gaim@robflynn.com>
parents: 67
diff changeset
996 gtk_widget_set_usize(entry, 300, 70);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
997
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
998 gtk_box_pack_start(GTK_BOX(bbox), send, TRUE, TRUE, 5);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
999 gtk_box_pack_start(GTK_BOX(bbox), info, TRUE, TRUE, 5);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1000 gtk_box_pack_start(GTK_BOX(bbox), warn, TRUE, TRUE, 5);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1001 gtk_box_pack_start(GTK_BOX(bbox), block, TRUE, TRUE, 5);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1002 gtk_box_pack_start(GTK_BOX(bbox), color, TRUE, TRUE, 5);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1003 gtk_box_pack_start(GTK_BOX(bbox), add, TRUE, TRUE, 5);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1004 gtk_box_pack_start(GTK_BOX(bbox), close, TRUE, TRUE, 5);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1005
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1006 /* pack and fill the rest */
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1007
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1008 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 5);
68
03ec647d24e9 [gaim-migrate @ 78]
Rob Flynn <gaim@robflynn.com>
parents: 67
diff changeset
1009 gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 5);
03ec647d24e9 [gaim-migrate @ 78]
Rob Flynn <gaim@robflynn.com>
parents: 67
diff changeset
1010 gtk_box_pack_start(GTK_BOX(vbox), entry, FALSE, FALSE, 5);
03ec647d24e9 [gaim-migrate @ 78]
Rob Flynn <gaim@robflynn.com>
parents: 67
diff changeset
1011 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 5);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1012
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1013
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1014
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1015
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1016 gtk_widget_show(send);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1017 gtk_widget_show(info);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1018 gtk_widget_show(warn);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1019 /* gtk_widget_show(color); */
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1020 gtk_widget_show(close);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1021 gtk_widget_show(add);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1022 gtk_widget_show(block);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1023 gtk_widget_show(bbox);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1024 gtk_widget_show(vbox);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1025 gtk_widget_show(entry);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1026 gtk_widget_show(text);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1027
67
65a118affac1 [gaim-migrate @ 77]
Rob Flynn <gaim@robflynn.com>
parents: 66
diff changeset
1028
68
03ec647d24e9 [gaim-migrate @ 78]
Rob Flynn <gaim@robflynn.com>
parents: 67
diff changeset
1029 gtk_container_add(GTK_CONTAINER(win), vbox);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1030 gtk_container_border_width(GTK_CONTAINER(win), 10);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1031
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1032 if ((find_log_info(c->name)) || ((general_options & OPT_GEN_LOG_ALL)))
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1033 g_snprintf(buf, sizeof(buf), LOG_CONVERSATION_TITLE, c->name);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1034 else
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1035 g_snprintf(buf, sizeof(buf), CONVERSATION_TITLE, c->name);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1036 gtk_window_set_title(GTK_WINDOW(win), buf);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1037 gtk_window_set_focus(GTK_WINDOW(win),entry);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1038
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1039 gtk_signal_connect(GTK_OBJECT(win), "delete_event", GTK_SIGNAL_FUNC(delete_event_convo), c);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1040 gtk_signal_connect(GTK_OBJECT(entry), "key_press_event", GTK_SIGNAL_FUNC(entry_key_pressed), entry);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1041
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1042 gtk_widget_show(win);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1043
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1044 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1045
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1046