Mercurial > pidgin-twitter
comparison prefs.c @ 254:c2620a99622b
- divided the source file into several parts.
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Sat, 22 Nov 2008 18:01:18 +0900 |
parents | |
children | 2d559555875f |
comparison
equal
deleted
inserted
replaced
253:a37ae6c8fa66 | 254:c2620a99622b |
---|---|
1 #include "pidgin-twitter.h" | |
2 | |
3 extern GHashTable *icon_hash[]; | |
4 extern source_t source; | |
5 | |
6 | |
7 /* prototypes */ | |
8 static void icon_size_prefs_cb(const char *name, PurplePrefType type, gconstpointer val, gpointer data); | |
9 static void interval_prefs_cb(const char *name, PurplePrefType type, gconstpointer val, gpointer data); | |
10 static void text_changed_cb(gpointer *data); | |
11 static void bool_toggled_cb(gpointer *data); | |
12 static void spin_changed_cb(gpointer *data); | |
13 static void combo_changed_cb(gpointer *data); | |
14 static void disconnect_prefs_cb(GtkObject *object, gpointer data); | |
15 static void counter_prefs_cb(const char *name, PurplePrefType type, gconstpointer val, gpointer data); | |
16 | |
17 | |
18 static void | |
19 counter_prefs_cb(const char *name, PurplePrefType type, | |
20 gconstpointer val, gpointer data) | |
21 { | |
22 gboolean enabled = purple_prefs_get_bool(OPT_COUNTER); | |
23 | |
24 if(enabled) | |
25 attach_to_window(); | |
26 else | |
27 detach_from_window(); | |
28 } | |
29 | |
30 static void | |
31 icon_size_prefs_cb(const char *name, PurplePrefType type, | |
32 gconstpointer val, gpointer data) | |
33 { | |
34 int i; | |
35 | |
36 /* invalidate icon cache */ | |
37 for(i = twitter_service; i < NUM_SERVICES; i++) { | |
38 g_hash_table_foreach(icon_hash[i], | |
39 (GHFunc)invalidate_icon_data_func, NULL); | |
40 } | |
41 } | |
42 | |
43 static void | |
44 interval_prefs_cb(const char *name, PurplePrefType type, | |
45 gconstpointer val, gpointer data) | |
46 { | |
47 /* remove idle func */ | |
48 g_source_remove_by_user_data((gpointer)(source.conv)); | |
49 | |
50 /* add idle func */ | |
51 if(purple_prefs_get_bool(OPT_API_BASE_POST)) { | |
52 source.id = g_timeout_add_seconds( | |
53 purple_prefs_get_int(OPT_API_BASE_GET_INTERVAL), | |
54 get_status_with_api, (gpointer)(source.conv)); | |
55 } | |
56 } | |
57 | |
58 static void | |
59 text_changed_cb(gpointer *data) | |
60 { | |
61 const gchar *text; | |
62 gchar *pref = (gchar *)g_object_get_data(G_OBJECT(data), "pref"); | |
63 text = gtk_entry_get_text(GTK_ENTRY(data)); | |
64 purple_prefs_set_string(pref, text); | |
65 } | |
66 | |
67 static void | |
68 bool_toggled_cb(gpointer *data) | |
69 { | |
70 gchar *pref = (gchar *)g_object_get_data(G_OBJECT(data), "pref"); | |
71 gboolean value = purple_prefs_get_bool(pref); | |
72 purple_prefs_set_bool(pref, !value); | |
73 } | |
74 | |
75 static void | |
76 spin_changed_cb(gpointer *data) | |
77 { | |
78 gchar *pref = (gchar *)g_object_get_data(G_OBJECT(data), "pref"); | |
79 | |
80 twitter_debug("called\n"); | |
81 | |
82 purple_prefs_set_int(pref, | |
83 gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(data))); | |
84 } | |
85 | |
86 static void | |
87 combo_changed_cb(gpointer *data) | |
88 { | |
89 gint position; | |
90 gchar *pref = (gchar *)g_object_get_data(G_OBJECT(data), "pref"); | |
91 position = gtk_combo_box_get_active(GTK_COMBO_BOX(data)); | |
92 purple_prefs_set_int(pref, position); | |
93 } | |
94 | |
95 static void | |
96 disconnect_prefs_cb(GtkObject *object, gpointer data) | |
97 { | |
98 PurplePlugin *plugin = (PurplePlugin *)data; | |
99 | |
100 purple_prefs_disconnect_by_handle(plugin); | |
101 } | |
102 | |
103 static void | |
104 api_base_post_cb(const char *name, PurplePrefType type, gconstpointer value, | |
105 gpointer data) | |
106 { | |
107 signed_on_cb(NULL); | |
108 get_status_with_api((gpointer)(source.conv)); | |
109 } | |
110 | |
111 GtkWidget * | |
112 prefs_get_frame(PurplePlugin *plugin) | |
113 { | |
114 GtkBuilder *builder; | |
115 GError *err = NULL; | |
116 gchar *filename; | |
117 GtkWidget *window, *notebook, *e; | |
118 const gchar *text; | |
119 GtkSpinButton *spin; | |
120 GtkObject *adjust; | |
121 gint value; | |
122 #ifdef _WIN32 | |
123 extern char binary_prefs_ui_start[]; | |
124 extern char binary_prefs_ui_size[]; | |
125 #endif | |
126 | |
127 builder = gtk_builder_new(); | |
128 | |
129 #ifdef _WIN32 | |
130 gtk_builder_add_from_string(builder, binary_prefs_ui_start, | |
131 (int)binary_prefs_ui_size, NULL); | |
132 #else | |
133 filename = g_build_filename(DATADIR, | |
134 "pidgin-twitter", "prefs.ui", NULL); | |
135 gtk_builder_add_from_file(builder, filename, &err); | |
136 #endif | |
137 | |
138 if(err) { | |
139 twitter_debug("%s\n", err->message); | |
140 g_free(filename); | |
141 return NULL; | |
142 } | |
143 | |
144 g_free(filename); | |
145 | |
146 gtk_builder_connect_signals(builder, NULL); | |
147 | |
148 window = GTK_WIDGET(gtk_builder_get_object(builder, "prefswindow")); | |
149 notebook = GTK_WIDGET(gtk_builder_get_object(builder, "prefsnotebook")); | |
150 | |
151 gtk_container_remove(GTK_CONTAINER(window), notebook); | |
152 | |
153 g_signal_connect(notebook, "destroy", | |
154 G_CALLBACK(disconnect_prefs_cb), plugin); | |
155 | |
156 | |
157 /**********************/ | |
158 /* connect to signals */ | |
159 /**********************/ | |
160 | |
161 /****************/ | |
162 /* account page */ | |
163 /****************/ | |
164 e = GTK_WIDGET(gtk_builder_get_object (builder, "account_twitter")); | |
165 g_object_set_data(G_OBJECT(e), "pref", OPT_SCREEN_NAME_TWITTER); | |
166 text = purple_prefs_get_string(OPT_SCREEN_NAME_TWITTER); | |
167 gtk_entry_set_text(GTK_ENTRY(e), text); | |
168 g_signal_connect(e, "changed", | |
169 G_CALLBACK(text_changed_cb), &e); | |
170 | |
171 e = GTK_WIDGET(gtk_builder_get_object (builder, "account_wassr")); | |
172 g_object_set_data(G_OBJECT(e), "pref", OPT_SCREEN_NAME_WASSR); | |
173 text = purple_prefs_get_string(OPT_SCREEN_NAME_WASSR); | |
174 gtk_entry_set_text(GTK_ENTRY(e), text); | |
175 g_signal_connect(e, "changed", | |
176 G_CALLBACK(text_changed_cb), &e); | |
177 | |
178 e = GTK_WIDGET(gtk_builder_get_object (builder, "account_identica")); | |
179 g_object_set_data(G_OBJECT(e), "pref", OPT_SCREEN_NAME_IDENTICA); | |
180 text = purple_prefs_get_string(OPT_SCREEN_NAME_IDENTICA); | |
181 gtk_entry_set_text(GTK_ENTRY(e), text); | |
182 g_signal_connect(e, "changed", | |
183 G_CALLBACK(text_changed_cb), &e); | |
184 | |
185 e = GTK_WIDGET(gtk_builder_get_object (builder, "account_jisko")); | |
186 g_object_set_data(G_OBJECT(e), "pref", OPT_SCREEN_NAME_JISKO); | |
187 text = purple_prefs_get_string(OPT_SCREEN_NAME_JISKO); | |
188 gtk_entry_set_text(GTK_ENTRY(e), text); | |
189 g_signal_connect(e, "changed", | |
190 G_CALLBACK(text_changed_cb), &e); | |
191 | |
192 e = GTK_WIDGET(gtk_builder_get_object (builder, "account_api")); | |
193 g_object_set_data(G_OBJECT(e), "pref", OPT_API_BASE_POST); | |
194 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), | |
195 purple_prefs_get_bool(OPT_API_BASE_POST)); | |
196 g_signal_connect(e, "toggled", | |
197 G_CALLBACK(bool_toggled_cb), &e); | |
198 purple_prefs_connect_callback(plugin, OPT_API_BASE_POST, /* xxx divide? */ | |
199 api_base_post_cb, NULL); | |
200 | |
201 e = GTK_WIDGET(gtk_builder_get_object (builder, "account_api_password")); | |
202 g_object_set_data(G_OBJECT(e), "pref", OPT_PASSWORD_TWITTER); | |
203 | |
204 gtk_entry_set_visibility(GTK_ENTRY(e), FALSE); | |
205 if (gtk_entry_get_invisible_char(GTK_ENTRY(e)) == '*') | |
206 gtk_entry_set_invisible_char(GTK_ENTRY(e), PIDGIN_INVISIBLE_CHAR); | |
207 | |
208 text = purple_prefs_get_string(OPT_PASSWORD_TWITTER); | |
209 gtk_entry_set_text(GTK_ENTRY(e), text); | |
210 g_signal_connect(e, "changed", | |
211 G_CALLBACK(text_changed_cb), &e); | |
212 | |
213 | |
214 /* interval spin */ | |
215 e = GTK_WIDGET(gtk_builder_get_object (builder, | |
216 "account_api_get_interval_spin")); | |
217 g_object_set_data(G_OBJECT(e), "pref", OPT_API_BASE_GET_INTERVAL); | |
218 | |
219 spin = GTK_SPIN_BUTTON(e); | |
220 | |
221 value = purple_prefs_get_int(OPT_API_BASE_GET_INTERVAL); | |
222 twitter_debug("spin value = %d\n", value); | |
223 | |
224 adjust = gtk_adjustment_new(value, 40, 3600, 10, 100, 100); | |
225 gtk_spin_button_set_adjustment(spin, GTK_ADJUSTMENT(adjust)); | |
226 gtk_widget_set_size_request(GTK_WIDGET(spin), 50, -1); | |
227 | |
228 if(value == 0) { | |
229 value = TWITTER_DEFAULT_INTERVAL; | |
230 purple_prefs_set_int(OPT_API_BASE_GET_INTERVAL, value); | |
231 } | |
232 gtk_spin_button_set_value(GTK_SPIN_BUTTON(e), (gdouble)value); | |
233 g_signal_connect(e, "value-changed", | |
234 G_CALLBACK(spin_changed_cb), &e); | |
235 purple_prefs_connect_callback(plugin, OPT_API_BASE_GET_INTERVAL, | |
236 interval_prefs_cb, NULL); | |
237 | |
238 | |
239 | |
240 /********************/ | |
241 /* translation page */ | |
242 /********************/ | |
243 e = GTK_WIDGET(gtk_builder_get_object (builder, "translation_recipient")); | |
244 g_object_set_data(G_OBJECT(e), "pref", OPT_TRANSLATE_RECIPIENT); | |
245 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), | |
246 purple_prefs_get_bool(OPT_TRANSLATE_RECIPIENT)); | |
247 g_signal_connect(e, "toggled", | |
248 G_CALLBACK(bool_toggled_cb), &e); | |
249 | |
250 e = GTK_WIDGET(gtk_builder_get_object (builder, "translation_sender")); | |
251 g_object_set_data(G_OBJECT(e), "pref", OPT_TRANSLATE_SENDER); | |
252 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), | |
253 purple_prefs_get_bool(OPT_TRANSLATE_SENDER)); | |
254 g_signal_connect(e, "toggled", | |
255 G_CALLBACK(bool_toggled_cb), &e); | |
256 | |
257 e = GTK_WIDGET(gtk_builder_get_object (builder, "translation_channel")); | |
258 g_object_set_data(G_OBJECT(e), "pref", OPT_TRANSLATE_CHANNEL); | |
259 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), | |
260 purple_prefs_get_bool(OPT_TRANSLATE_CHANNEL)); | |
261 g_signal_connect(e, "toggled", | |
262 G_CALLBACK(bool_toggled_cb), &e); | |
263 | |
264 | |
265 | |
266 /***************/ | |
267 /* filter page */ | |
268 /***************/ | |
269 e = GTK_WIDGET(gtk_builder_get_object (builder, "filter_filter_check")); | |
270 g_object_set_data(G_OBJECT(e), "pref", OPT_FILTER); | |
271 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), | |
272 purple_prefs_get_bool(OPT_FILTER)); | |
273 g_signal_connect(e, "toggled", | |
274 G_CALLBACK(bool_toggled_cb), &e); | |
275 | |
276 e = GTK_WIDGET(gtk_builder_get_object (builder, "filter_exclude_reply_check")); | |
277 g_object_set_data(G_OBJECT(e), "pref", OPT_FILTER_EXCLUDE_REPLY); | |
278 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), | |
279 purple_prefs_get_bool(OPT_FILTER_EXCLUDE_REPLY)); | |
280 g_signal_connect(e, "toggled", | |
281 G_CALLBACK(bool_toggled_cb), &e); | |
282 | |
283 e = GTK_WIDGET(gtk_builder_get_object (builder, "filter_twitter")); | |
284 g_object_set_data(G_OBJECT(e), "pref", OPT_FILTER_TWITTER); | |
285 text = purple_prefs_get_string(OPT_FILTER_TWITTER); | |
286 gtk_entry_set_text(GTK_ENTRY(e), text); | |
287 g_signal_connect(e, "changed", | |
288 G_CALLBACK(text_changed_cb), &e); | |
289 | |
290 e = GTK_WIDGET(gtk_builder_get_object (builder, "filter_wassr")); | |
291 g_object_set_data(G_OBJECT(e), "pref", OPT_FILTER_WASSR); | |
292 text = purple_prefs_get_string(OPT_FILTER_WASSR); | |
293 gtk_entry_set_text(GTK_ENTRY(e), text); | |
294 g_signal_connect(e, "changed", | |
295 G_CALLBACK(text_changed_cb), &e); | |
296 | |
297 e = GTK_WIDGET(gtk_builder_get_object (builder, "filter_identica")); | |
298 g_object_set_data(G_OBJECT(e), "pref", OPT_FILTER_IDENTICA); | |
299 text = purple_prefs_get_string(OPT_FILTER_IDENTICA); | |
300 gtk_entry_set_text(GTK_ENTRY(e), text); | |
301 g_signal_connect(e, "changed", | |
302 G_CALLBACK(text_changed_cb), &e); | |
303 | |
304 e = GTK_WIDGET(gtk_builder_get_object (builder, "filter_jisko")); | |
305 g_object_set_data(G_OBJECT(e), "pref", OPT_FILTER_JISKO); | |
306 text = purple_prefs_get_string(OPT_FILTER_JISKO); | |
307 gtk_entry_set_text(GTK_ENTRY(e), text); | |
308 g_signal_connect(e, "changed", | |
309 G_CALLBACK(text_changed_cb), &e); | |
310 | |
311 | |
312 | |
313 /*************/ | |
314 /* icon page */ | |
315 /*************/ | |
316 e = GTK_WIDGET(gtk_builder_get_object (builder, "icon_show_icon")); | |
317 g_object_set_data(G_OBJECT(e), "pref", OPT_SHOW_ICON); | |
318 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), | |
319 purple_prefs_get_bool(OPT_SHOW_ICON)); | |
320 g_signal_connect(e, "toggled", | |
321 G_CALLBACK(bool_toggled_cb), &e); | |
322 | |
323 /* icon size spin */ | |
324 e = GTK_WIDGET(gtk_builder_get_object (builder, "icon_icon_size_spin")); | |
325 g_object_set_data(G_OBJECT(e), "pref", OPT_ICON_SIZE); | |
326 | |
327 spin = GTK_SPIN_BUTTON(e); | |
328 | |
329 value = purple_prefs_get_int(OPT_ICON_SIZE); | |
330 twitter_debug("spin value = %d\n", value); | |
331 | |
332 adjust = gtk_adjustment_new(value, 16, 128, 4, 4, 4); | |
333 gtk_spin_button_set_adjustment(spin, GTK_ADJUSTMENT(adjust)); | |
334 gtk_widget_set_size_request(GTK_WIDGET(spin), 50, -1); | |
335 | |
336 if(value == 0) { | |
337 value = DEFAULT_ICON_SIZE; | |
338 purple_prefs_set_int(OPT_ICON_SIZE, value); | |
339 } | |
340 gtk_spin_button_set_value(GTK_SPIN_BUTTON(e), (gdouble)value); | |
341 g_signal_connect(e, "value-changed", | |
342 G_CALLBACK(spin_changed_cb), &e); | |
343 purple_prefs_connect_callback(plugin, OPT_ICON_SIZE, | |
344 icon_size_prefs_cb, NULL); | |
345 | |
346 /* enable update */ | |
347 e = GTK_WIDGET(gtk_builder_get_object (builder, "icon_enable_update")); | |
348 g_object_set_data(G_OBJECT(e), "pref", OPT_UPDATE_ICON); | |
349 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), | |
350 purple_prefs_get_bool(OPT_UPDATE_ICON)); | |
351 g_signal_connect(e, "toggled", | |
352 G_CALLBACK(bool_toggled_cb), &e); | |
353 | |
354 /* max count spin */ | |
355 e = GTK_WIDGET(gtk_builder_get_object (builder, "icon_max_count_spin")); | |
356 g_object_set_data(G_OBJECT(e), "pref", OPT_ICON_MAX_COUNT); | |
357 | |
358 spin = GTK_SPIN_BUTTON(e); | |
359 | |
360 value = purple_prefs_get_int(OPT_ICON_MAX_COUNT); | |
361 twitter_debug("spin value = %d\n", value); | |
362 | |
363 adjust = gtk_adjustment_new(value, 2, 10000, 1, 10, 10); | |
364 gtk_spin_button_set_adjustment(spin, GTK_ADJUSTMENT(adjust)); | |
365 gtk_widget_set_size_request(GTK_WIDGET(spin), 50, -1); | |
366 | |
367 if(value == 0) { | |
368 value = DEFAULT_ICON_MAX_COUNT; | |
369 purple_prefs_set_int(OPT_ICON_MAX_COUNT, value); | |
370 } | |
371 gtk_spin_button_set_value(GTK_SPIN_BUTTON(e), (gdouble)value); | |
372 g_signal_connect(e, "value-changed", | |
373 G_CALLBACK(spin_changed_cb), &e); | |
374 | |
375 | |
376 /* max days spin */ | |
377 e = GTK_WIDGET(gtk_builder_get_object (builder, "icon_max_days_spin")); | |
378 g_object_set_data(G_OBJECT(e), "pref", OPT_ICON_MAX_DAYS); | |
379 | |
380 spin = GTK_SPIN_BUTTON(e); | |
381 | |
382 value = purple_prefs_get_int(OPT_ICON_MAX_DAYS); | |
383 twitter_debug("spin value = %d\n", value); | |
384 | |
385 adjust = gtk_adjustment_new(value, 1, 180, 1, 10, 10); | |
386 gtk_spin_button_set_adjustment(spin, GTK_ADJUSTMENT(adjust)); | |
387 gtk_widget_set_size_request(GTK_WIDGET(spin), 50, -1); | |
388 | |
389 if(value == 0) { | |
390 value = DEFAULT_ICON_MAX_DAYS; | |
391 purple_prefs_set_int(OPT_ICON_MAX_DAYS, value); | |
392 } | |
393 gtk_spin_button_set_value(GTK_SPIN_BUTTON(e), (gdouble)value); | |
394 g_signal_connect(e, "value-changed", | |
395 G_CALLBACK(spin_changed_cb), &e); | |
396 | |
397 | |
398 | |
399 /**************/ | |
400 /* sound page */ | |
401 /**************/ | |
402 e = GTK_WIDGET(gtk_builder_get_object (builder, "sound_recip_check")); | |
403 g_object_set_data(G_OBJECT(e), "pref", OPT_PLAYSOUND_RECIPIENT); | |
404 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), | |
405 purple_prefs_get_bool(OPT_PLAYSOUND_RECIPIENT)); | |
406 g_signal_connect(e, "toggled", | |
407 G_CALLBACK(bool_toggled_cb), &e); | |
408 | |
409 e = GTK_WIDGET(gtk_builder_get_object (builder, "sound_recip_list")); | |
410 g_object_set_data(G_OBJECT(e), "pref", OPT_USERLIST_RECIPIENT); | |
411 text = purple_prefs_get_string(OPT_USERLIST_RECIPIENT); | |
412 gtk_entry_set_text(GTK_ENTRY(e), text); | |
413 g_signal_connect(e, "changed", | |
414 G_CALLBACK(text_changed_cb), &e); | |
415 | |
416 /* recipient combobox */ | |
417 e = GTK_WIDGET(gtk_builder_get_object (builder, "sound_recip_combo")); | |
418 gtk_combo_box_set_active(GTK_COMBO_BOX(e), | |
419 purple_prefs_get_int(OPT_SOUNDID_RECIPIENT)); | |
420 g_object_set_data(G_OBJECT(e), "pref", OPT_SOUNDID_RECIPIENT); | |
421 g_signal_connect(e, "changed", | |
422 G_CALLBACK(combo_changed_cb), &e); | |
423 | |
424 | |
425 | |
426 e = GTK_WIDGET(gtk_builder_get_object (builder, "sound_send_check")); | |
427 g_object_set_data(G_OBJECT(e), "pref", OPT_PLAYSOUND_SENDER); | |
428 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), | |
429 purple_prefs_get_bool(OPT_PLAYSOUND_SENDER)); | |
430 g_signal_connect(e, "toggled", | |
431 G_CALLBACK(bool_toggled_cb), &e); | |
432 | |
433 e = GTK_WIDGET(gtk_builder_get_object (builder, "sound_send_list")); | |
434 g_object_set_data(G_OBJECT(e), "pref", OPT_USERLIST_SENDER); | |
435 text = purple_prefs_get_string(OPT_USERLIST_SENDER); | |
436 gtk_entry_set_text(GTK_ENTRY(e), text); | |
437 g_signal_connect(e, "changed", | |
438 G_CALLBACK(text_changed_cb), &e); | |
439 | |
440 /* sender combobox */ | |
441 e = GTK_WIDGET(gtk_builder_get_object (builder, "sound_send_combo")); | |
442 gtk_combo_box_set_active(GTK_COMBO_BOX(e), | |
443 purple_prefs_get_int(OPT_SOUNDID_RECIPIENT)); | |
444 g_object_set_data(G_OBJECT(e), "pref", OPT_SOUNDID_SENDER); | |
445 g_signal_connect(e, "changed", | |
446 G_CALLBACK(combo_changed_cb), &e); | |
447 | |
448 | |
449 | |
450 | |
451 /****************/ | |
452 /* utility page */ | |
453 /****************/ | |
454 e = GTK_WIDGET(gtk_builder_get_object (builder, "utility_counter")); | |
455 g_object_set_data(G_OBJECT(e), "pref", OPT_COUNTER); | |
456 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), | |
457 purple_prefs_get_bool(OPT_COUNTER)); | |
458 g_signal_connect(e, "toggled", | |
459 G_CALLBACK(bool_toggled_cb), &e); | |
460 purple_prefs_connect_callback(plugin, OPT_COUNTER, | |
461 counter_prefs_cb, NULL); | |
462 | |
463 e = GTK_WIDGET(gtk_builder_get_object (builder, "utility_pseudo")); | |
464 g_object_set_data(G_OBJECT(e), "pref", OPT_ESCAPE_PSEUDO); | |
465 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), | |
466 purple_prefs_get_bool(OPT_ESCAPE_PSEUDO)); | |
467 g_signal_connect(e, "toggled", | |
468 G_CALLBACK(bool_toggled_cb), &e); | |
469 | |
470 e = GTK_WIDGET(gtk_builder_get_object (builder, "utility_oops")); | |
471 g_object_set_data(G_OBJECT(e), "pref", OPT_SUPPRESS_OOPS); | |
472 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), | |
473 purple_prefs_get_bool(OPT_SUPPRESS_OOPS)); | |
474 g_signal_connect(e, "toggled", | |
475 G_CALLBACK(bool_toggled_cb), &e); | |
476 | |
477 e = GTK_WIDGET(gtk_builder_get_object (builder, "utility_strip_excess_lf")); | |
478 g_object_set_data(G_OBJECT(e), "pref", OPT_STRIP_EXCESS_LF); | |
479 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), | |
480 purple_prefs_get_bool(OPT_STRIP_EXCESS_LF)); | |
481 g_signal_connect(e, "toggled", | |
482 G_CALLBACK(bool_toggled_cb), &e); | |
483 | |
484 e = GTK_WIDGET(gtk_builder_get_object (builder, "utility_notify")); | |
485 g_object_set_data(G_OBJECT(e), "pref", OPT_PREVENT_NOTIFICATION); | |
486 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), | |
487 purple_prefs_get_bool(OPT_PREVENT_NOTIFICATION)); | |
488 g_signal_connect(e, "toggled", | |
489 G_CALLBACK(bool_toggled_cb), &e); | |
490 | |
491 e = GTK_WIDGET(gtk_builder_get_object (builder, "utility_log_output")); | |
492 g_object_set_data(G_OBJECT(e), "pref", OPT_LOG_OUTPUT); | |
493 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), | |
494 purple_prefs_get_bool(OPT_LOG_OUTPUT)); | |
495 g_signal_connect(e, "toggled", | |
496 G_CALLBACK(bool_toggled_cb), &e); | |
497 | |
498 | |
499 /* all done */ | |
500 gtk_widget_show_all(notebook); | |
501 return notebook; | |
502 } |