annotate gtk/plugins/convcolors.c @ 15315:28051164843c

[gaim-migrate @ 18106] Do not crash trying to tag/attach NULL nodes. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Thu, 11 Jan 2007 07:42:51 +0000
parents 8bc394797096
children 2db21e0292b8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15169
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /*
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 * Conversation Colors
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 * Copyright (C) 2006
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 *
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * This program is free software; you can redistribute it and/or
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 * modify it under the terms of the GNU General Public License as
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 * published by the Free Software Foundation; either version 2 of the
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 * License, or (at your option) any later version.
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 *
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful, but
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 * General Public License for more details.
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 *
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 * along with this program; if not, write to the Free Software
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 * 02111-1307, USA.
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19 */
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
20 #include "internal.h"
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22 #define PLUGIN_ID "gtk-plugin_pack-convcolors"
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23 #define PLUGIN_NAME "Conversation Colors"
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24 #define PLUGIN_STATIC_NAME "Conversation Colors"
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
25 #define PLUGIN_SUMMARY "Customize colors in the conversation window"
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26 #define PLUGIN_DESCRIPTION "Customize colors in the conversation window"
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27 #define PLUGIN_AUTHOR "Sadrul H Chowdhury <sadrul@users.sourceforge.net>"
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29 /* System headers */
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30 #include <gdk/gdk.h>
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31 #include <glib.h>
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32 #include <gtk/gtk.h>
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
33
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34 /* Gaim headers */
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35 #include <gtkplugin.h>
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 #include <version.h>
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38 #include <conversation.h>
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39 #include <gtkconv.h>
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40 #include <gtkprefs.h>
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41 #include <gtkutils.h>
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43 #define PREF_PREFIX "/plugins/gtk/" PLUGIN_ID
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44 #define PREF_IGNORE PREF_PREFIX "/ignore_incoming"
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 #define PREF_CHATS PREF_PREFIX "/chats"
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46 #define PREF_IMS PREF_PREFIX "/ims"
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
47
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48 #define PREF_SEND PREF_PREFIX "/send"
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49 #define PREF_SEND_C PREF_SEND "/color"
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
50 #define PREF_SEND_F PREF_SEND "/format"
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
51
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52 #define PREF_RECV PREF_PREFIX "/recv"
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 #define PREF_RECV_C PREF_RECV "/color"
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54 #define PREF_RECV_F PREF_RECV "/format"
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56 #define PREF_SYSTEM PREF_PREFIX "/system"
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57 #define PREF_SYSTEM_C PREF_SYSTEM "/color"
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58 #define PREF_SYSTEM_F PREF_SYSTEM "/format"
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60 #define PREF_ERROR PREF_PREFIX "/error"
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
61 #define PREF_ERROR_C PREF_ERROR "/color"
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
62 #define PREF_ERROR_F PREF_ERROR "/format"
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64 #define PREF_NICK PREF_PREFIX "/nick"
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
65 #define PREF_NICK_C PREF_NICK "/color"
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66 #define PREF_NICK_F PREF_NICK "/format"
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
67
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
68 enum
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
69 {
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
70 FONT_BOLD = 1 << 0,
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
71 FONT_ITALIC = 1 << 1,
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
72 FONT_UNDERLINE = 1 << 2
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
73 };
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
74
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75 struct
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
76 {
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
77 GaimMessageFlags flag;
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
78 char *prefix;
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79 const char *text;
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
80 } formats[] =
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
81 {
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
82 {GAIM_MESSAGE_ERROR, PREF_ERROR, N_("Error Messages")},
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
83 {GAIM_MESSAGE_NICK, PREF_NICK, N_("Highlighted Messages")},
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
84 {GAIM_MESSAGE_SYSTEM, PREF_SYSTEM, N_("System Messages")},
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
85 {GAIM_MESSAGE_SEND, PREF_SEND, N_("Sent Messages")},
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
86 {GAIM_MESSAGE_RECV, PREF_RECV, N_("Received Messages")},
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
87 {0, NULL, NULL}
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
88 };
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
89
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
90 static gboolean
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
91 displaying_msg(GaimAccount *account, const char *who, char **displaying,
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
92 GaimConversation *conv, GaimMessageFlags flags)
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
93 {
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
94 int i;
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
95 char tmp[128], *t;
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
96 gboolean bold, italic, underline;
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
97 int f;
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
98 const char *color;
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
99
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
100 for (i = 0; formats[i].prefix; i++)
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
101 if (flags & formats[i].flag)
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
102 break;
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
103
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
104 if (!formats[i].prefix)
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
105 return FALSE;
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
106
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
107 if ((gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM &&
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
108 !gaim_prefs_get_bool(PREF_IMS)) ||
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
109 (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT &&
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
110 !gaim_prefs_get_bool(PREF_CHATS)))
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
111 return FALSE;
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
112
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
113 g_snprintf(tmp, sizeof(tmp), "%s/color", formats[i].prefix);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
114 color = gaim_prefs_get_string(tmp);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
115
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
116 g_snprintf(tmp, sizeof(tmp), "%s/format", formats[i].prefix);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
117 f = gaim_prefs_get_int(tmp);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
118 bold = (f & FONT_BOLD);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
119 italic = (f & FONT_ITALIC);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
120 underline = (f & FONT_UNDERLINE);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
121
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
122 if (gaim_prefs_get_bool(PREF_IGNORE))
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
123 {
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
124 t = *displaying;
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
125 *displaying = gaim_markup_strip_html(t);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
126 g_free(t);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
127 }
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
128
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
129 if (color && *color)
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
130 {
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
131 t = *displaying;
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
132 *displaying = g_strdup_printf("<FONT COLOR=\"%s\">%s</FONT>", color, t);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
133 g_free(t);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
134 }
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
135
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
136 t = *displaying;
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
137 *displaying = g_strdup_printf("%s%s%s%s%s%s%s",
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
138 bold ? "<B>" : "</B>",
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
139 italic ? "<I>" : "</I>",
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
140 underline ? "<U>" : "</U>",
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
141 t,
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
142 bold ? "</B>" : "<B>",
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
143 italic ? "</I>" : "<I>",
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
144 underline ? "</U>" : "<U>"
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
145 );
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
146 g_free(t);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
147
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
148 return FALSE;
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
149 }
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
150
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
151 static gboolean
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
152 plugin_load(GaimPlugin *plugin)
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
153 {
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
154 gaim_signal_connect(gaim_gtk_conversations_get_handle(),
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
155 "displaying-im-msg", plugin,
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
156 GAIM_CALLBACK(displaying_msg), NULL);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
157 gaim_signal_connect(gaim_gtk_conversations_get_handle(),
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
158 "displaying-chat-msg", plugin,
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
159 GAIM_CALLBACK(displaying_msg), NULL);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
160 return TRUE;
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
161 }
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
162
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
163 static gboolean
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
164 plugin_unload(GaimPlugin *plugin)
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
165 {
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
166 return TRUE;
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
167 }
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
168
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
169 /* Ripped from GaimRC */
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
170 static void
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
171 color_response(GtkDialog *color_dialog, gint response, const char *data)
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
172 {
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
173 if (response == GTK_RESPONSE_OK)
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
174 {
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
175 GtkWidget *colorsel = GTK_COLOR_SELECTION_DIALOG(color_dialog)->colorsel;
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
176 GdkColor color;
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
177 char colorstr[8];
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
178 char tmp[128];
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
179
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
180 gtk_color_selection_get_current_color(GTK_COLOR_SELECTION(colorsel), &color);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
181
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
182 g_snprintf(colorstr, sizeof(colorstr), "#%02X%02X%02X",
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
183 color.red/256, color.green/256, color.blue/256);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
184
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
185 g_snprintf(tmp, sizeof(tmp), "%s/color", data);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
186
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
187 gaim_prefs_set_string(tmp, colorstr);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
188 }
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
189
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
190 gtk_widget_destroy(GTK_WIDGET(color_dialog));
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
191 }
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
192
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
193 static void
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
194 set_color(GtkWidget *widget, const char *data)
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
195 {
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
196 GtkWidget *color_dialog = NULL;
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
197 GdkColor color;
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
198 char title[128];
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
199 char tmp[128];
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
200
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
201 g_snprintf(title, sizeof(title), _("Select Color for %s"), _(data));
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
202 color_dialog = gtk_color_selection_dialog_new(title);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
203 g_signal_connect(G_OBJECT(color_dialog), "response",
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
204 G_CALLBACK(color_response), (gpointer)data);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
205
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
206 g_snprintf(tmp, sizeof(tmp), "%s/color", data);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
207 if (gdk_color_parse(gaim_prefs_get_string(tmp), &color))
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
208 {
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
209 gtk_color_selection_set_current_color(
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
210 GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(color_dialog)->colorsel), &color);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
211 }
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
212
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
213 gtk_window_present(GTK_WINDOW(color_dialog));
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
214 }
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
215
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
216 static void
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
217 toggle_something(const char *prefix, int format)
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
218 {
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
219 int f;
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
220 char tmp[128];
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
221
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
222 g_snprintf(tmp, sizeof(tmp), "%s/format", prefix);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
223 f = gaim_prefs_get_int(tmp);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
224 f ^= format;
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
225 gaim_prefs_set_int(tmp, f);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
226 }
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
227
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
228 static void
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
229 toggle_bold(GtkWidget *widget, gpointer data)
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
230 {
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
231 toggle_something(data, FONT_BOLD);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
232 }
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
233
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
234 static void
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
235 toggle_italic(GtkWidget *widget, gpointer data)
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
236 {
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
237 toggle_something(data, FONT_ITALIC);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
238 }
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
239
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
240 static void
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
241 toggle_underline(GtkWidget *widget, gpointer data)
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
242 {
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
243 toggle_something(data, FONT_UNDERLINE);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
244 }
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
245
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
246 static GtkWidget *
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
247 get_config_frame(GaimPlugin *plugin)
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
248 {
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
249 GtkWidget *ret;
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
250 GtkWidget *frame;
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
251 int i;
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
252
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
253 ret = gtk_vbox_new(FALSE, GAIM_HIG_CAT_SPACE);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
254 gtk_container_set_border_width(GTK_CONTAINER(ret), GAIM_HIG_BORDER);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
255
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
256 for (i = 0; formats[i].prefix; i++)
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
257 {
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
258 char tmp[128];
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
259 int f;
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
260 GtkWidget *vbox, *hbox, *button;
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
261
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
262 g_snprintf(tmp, sizeof(tmp), "%s/format", formats[i].prefix);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
263 f = gaim_prefs_get_int(tmp);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
264
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
265 frame = gaim_gtk_make_frame(ret, _(formats[i].text));
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
266 vbox = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
267 gtk_box_pack_start(GTK_BOX(frame), vbox, FALSE, FALSE, 0);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
268
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
269 hbox = gtk_hbox_new(FALSE, GAIM_HIG_BOX_SPACE);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
270 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
271
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
272 button = gaim_pixbuf_button_from_stock(" Color", GTK_STOCK_SELECT_COLOR,
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
273 GAIM_BUTTON_HORIZONTAL);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
274 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
275 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(set_color),
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
276 formats[i].prefix);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
277
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
278 button = gtk_check_button_new_with_label(_("Bold"));
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
279 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
280 if (f & FONT_BOLD)
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
281 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
282 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(toggle_bold),
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
283 formats[i].prefix);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
284
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
285 button = gtk_check_button_new_with_label(_("Italic"));
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
286 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
287 if (f & FONT_ITALIC)
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
288 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
289 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(toggle_italic),
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
290 formats[i].prefix);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
291
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
292 button = gtk_check_button_new_with_label(_("Underline"));
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
293 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
294 if (f & FONT_UNDERLINE)
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
295 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
296 g_signal_connect(G_OBJECT(button), "clicked",
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
297 G_CALLBACK(toggle_underline), formats[i].prefix);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
298 }
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
299
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
300 frame = gaim_gtk_make_frame(ret, _("General"));
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
301 gaim_gtk_prefs_checkbox(_("Ignore incoming format"), PREF_IGNORE, frame);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
302 gaim_gtk_prefs_checkbox(_("Apply in Chats"), PREF_CHATS, frame);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
303 gaim_gtk_prefs_checkbox(_("Apply in IMs"), PREF_IMS, frame);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
304
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
305 gtk_widget_show_all(ret);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
306 return ret;
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
307 }
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
308
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
309 static GaimGtkPluginUiInfo ui_info =
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
310 {
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
311 get_config_frame,
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
312 0,
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
313 };
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
314
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
315 static GaimPluginInfo info =
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
316 {
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
317 GAIM_PLUGIN_MAGIC, /* Magic */
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
318 GAIM_MAJOR_VERSION, /* Gaim Major Version */
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
319 GAIM_MINOR_VERSION, /* Gaim Minor Version */
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
320 GAIM_PLUGIN_STANDARD, /* plugin type */
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
321 GAIM_GTK_PLUGIN_TYPE, /* ui requirement */
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
322 0, /* flags */
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
323 NULL, /* dependencies */
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
324 GAIM_PRIORITY_DEFAULT, /* priority */
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
325
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
326 PLUGIN_ID, /* plugin id */
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
327 N_(PLUGIN_NAME), /* name */
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
328 VERSION, /* version */
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
329 N_(PLUGIN_SUMMARY), /* summary */
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
330 N_(PLUGIN_DESCRIPTION), /* description */
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
331 PLUGIN_AUTHOR, /* author */
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
332 GAIM_WEBSITE, /* website */
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
333
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
334 plugin_load, /* load */
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
335 plugin_unload, /* unload */
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
336 NULL, /* destroy */
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
337
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
338 &ui_info, /* ui_info */
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
339 NULL, /* extra_info */
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
340 NULL, /* prefs_info */
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
341 NULL /* actions */
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
342 };
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
343
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
344 static void
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
345 init_plugin(GaimPlugin *plugin)
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
346 {
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
347 gaim_prefs_add_none(PREF_PREFIX);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
348
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
349 gaim_prefs_add_bool(PREF_IGNORE, TRUE);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
350 gaim_prefs_add_bool(PREF_CHATS, TRUE);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
351 gaim_prefs_add_bool(PREF_IMS, TRUE);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
352
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
353 gaim_prefs_add_none(PREF_SEND);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
354 gaim_prefs_add_none(PREF_RECV);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
355 gaim_prefs_add_none(PREF_SYSTEM);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
356 gaim_prefs_add_none(PREF_ERROR);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
357 gaim_prefs_add_none(PREF_NICK);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
358
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
359 gaim_prefs_add_string(PREF_SEND_C, "#909090");
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
360 gaim_prefs_add_string(PREF_RECV_C, "#000000");
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
361 gaim_prefs_add_string(PREF_SYSTEM_C, "#50a050");
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
362 gaim_prefs_add_string(PREF_ERROR_C, "#ff0000");
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
363 gaim_prefs_add_string(PREF_NICK_C, "#0000dd");
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
364
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
365 gaim_prefs_add_int(PREF_SEND_F, 0);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
366 gaim_prefs_add_int(PREF_RECV_F, 0);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
367 gaim_prefs_add_int(PREF_SYSTEM_F, FONT_ITALIC);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
368 gaim_prefs_add_int(PREF_ERROR_F, FONT_BOLD | FONT_UNDERLINE);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
369 gaim_prefs_add_int(PREF_NICK_F, FONT_BOLD);
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
370 }
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
371
8bc394797096 [gaim-migrate @ 17955]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
372 GAIM_INIT_PLUGIN(PLUGIN_STATIC_NAME, init_plugin, info)