Mercurial > pidgin.yaz
comparison finch/plugins/gnthistory.c @ 21487:f2e42e09e635
Allow turning on logging when enabling the gnthistory plugin. (this doesn't
add new strings)
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Wed, 14 Nov 2007 05:27:47 +0000 |
parents | 3cc856ca2338 |
children | 665e04562de0 |
comparison
equal
deleted
inserted
replaced
21486:c8cdf0bcc8e3 | 21487:f2e42e09e635 |
---|---|
23 #include "internal.h" | 23 #include "internal.h" |
24 | 24 |
25 #include "conversation.h" | 25 #include "conversation.h" |
26 #include "debug.h" | 26 #include "debug.h" |
27 #include "log.h" | 27 #include "log.h" |
28 #include "notify.h" | 28 #include "request.h" |
29 #include "prefs.h" | 29 #include "prefs.h" |
30 #include "signals.h" | 30 #include "signals.h" |
31 #include "util.h" | 31 #include "util.h" |
32 #include "version.h" | 32 #include "version.h" |
33 | 33 |
34 #include "gntplugin.h" | 34 #include "gntplugin.h" |
35 #include "gntrequest.h" | |
35 | 36 |
36 #define HISTORY_PLUGIN_ID "gnt-history" | 37 #define HISTORY_PLUGIN_ID "gnt-history" |
37 | 38 |
38 #define HISTORY_SIZE (4 * 1024) | 39 #define HISTORY_SIZE (4 * 1024) |
39 | 40 |
133 history_prefs_check(PurplePlugin *plugin) | 134 history_prefs_check(PurplePlugin *plugin) |
134 { | 135 { |
135 if (!purple_prefs_get_bool("/purple/logging/log_ims") && | 136 if (!purple_prefs_get_bool("/purple/logging/log_ims") && |
136 !purple_prefs_get_bool("/purple/logging/log_chats")) | 137 !purple_prefs_get_bool("/purple/logging/log_chats")) |
137 { | 138 { |
138 purple_notify_warning(plugin, NULL, _("History Plugin Requires Logging"), | 139 PurpleRequestFields *fields = purple_request_fields_new(); |
140 PurpleRequestFieldGroup *group; | |
141 PurpleRequestField *field; | |
142 struct { | |
143 const char *pref; | |
144 const char *label; | |
145 } prefs[] = { | |
146 {"/purple/logging/log_ims", N_("Log IMs")}, | |
147 {"/purple/logging/log_chats", N_("Log chats")}, | |
148 {NULL, NULL} | |
149 }; | |
150 int iter; | |
151 GList *list = purple_log_logger_get_options(); | |
152 const char *system = purple_prefs_get_string("/purple/logging/format"); | |
153 | |
154 group = purple_request_field_group_new(_("Logging")); | |
155 | |
156 field = purple_request_field_list_new("/purple/logging/format", _("Log format")); | |
157 while (list) { | |
158 const char *label = _(list->data); | |
159 list = g_list_delete_link(list, list); | |
160 purple_request_field_list_add(field, label, list->data); | |
161 if (system && strcmp(system, list->data) == 0) | |
162 purple_request_field_list_add_selected(field, label); | |
163 list = g_list_delete_link(list, list); | |
164 } | |
165 purple_request_field_group_add_field(group, field); | |
166 | |
167 for (iter = 0; prefs[iter].pref; iter++) { | |
168 field = purple_request_field_bool_new(prefs[iter].pref, _(prefs[iter].label), | |
169 purple_prefs_get_bool(prefs[iter].pref)); | |
170 purple_request_field_group_add_field(group, field); | |
171 } | |
172 | |
173 purple_request_fields_add_group(fields, group); | |
174 | |
175 purple_request_fields_with_hint(plugin, NULL, _("History Plugin Requires Logging"), | |
139 _("Logging can be enabled from Tools -> Preferences -> Logging.\n\n" | 176 _("Logging can be enabled from Tools -> Preferences -> Logging.\n\n" |
140 "Enabling logs for instant messages and/or chats will activate " | 177 "Enabling logs for instant messages and/or chats will activate " |
141 "history for the same conversation type(s).")); | 178 "history for the same conversation type(s)."), |
179 fields, | |
180 _("OK"), G_CALLBACK(finch_request_save_in_prefs), | |
181 _("Cancel"), NULL, | |
182 NULL, NULL, NULL, | |
183 "42. That's your hint. Take it, or leave it.", plugin); | |
142 } | 184 } |
143 } | 185 } |
144 | 186 |
145 static void history_prefs_cb(const char *name, PurplePrefType type, | 187 static void history_prefs_cb(const char *name, PurplePrefType type, |
146 gconstpointer val, gpointer data) | 188 gconstpointer val, gpointer data) |