Mercurial > pidgin
annotate console/gntprefs.c @ 15061:75034345bf52
[gaim-migrate @ 17845]
Fix gaim_account_set_status() in perl plugins.
committer: Tailor Script <tailor@pidgin.im>
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Wed, 29 Nov 2006 17:20:39 +0000 |
parents | 81650a27f253 |
children | ac460d00e235 |
rev | line source |
---|---|
14558
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14399
diff
changeset
|
1 /** |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14399
diff
changeset
|
2 * @file gntprefs.c GNT Preferences API |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14399
diff
changeset
|
3 * @ingroup gntui |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14399
diff
changeset
|
4 * |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14399
diff
changeset
|
5 * gaim |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14399
diff
changeset
|
6 * |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14399
diff
changeset
|
7 * Gaim is the legal property of its developers, whose names are too numerous |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14399
diff
changeset
|
8 * to list here. Please refer to the COPYRIGHT file distributed with this |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14399
diff
changeset
|
9 * source distribution. |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14399
diff
changeset
|
10 * |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14399
diff
changeset
|
11 * This program is free software; you can redistribute it and/or modify |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14399
diff
changeset
|
12 * it under the terms of the GNU General Public License as published by |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14399
diff
changeset
|
13 * the Free Software Foundation; either version 2 of the License, or |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14399
diff
changeset
|
14 * (at your option) any later version. |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14399
diff
changeset
|
15 * |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14399
diff
changeset
|
16 * This program is distributed in the hope that it will be useful, |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14399
diff
changeset
|
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14399
diff
changeset
|
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14399
diff
changeset
|
19 * GNU General Public License for more details. |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14399
diff
changeset
|
20 * |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14399
diff
changeset
|
21 * You should have received a copy of the GNU General Public License |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14399
diff
changeset
|
22 * along with this program; if not, write to the Free Software |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14399
diff
changeset
|
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14399
diff
changeset
|
24 */ |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
25 #include <prefs.h> |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
26 |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
27 #include "gntgaim.h" |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
28 #include "gntprefs.h" |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
29 #include "gntrequest.h" |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
30 |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
31 #include <string.h> |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
32 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
33 void gg_prefs_init() |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
34 { |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
35 gaim_prefs_add_none("/gaim"); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
36 gaim_prefs_add_none("/gaim/gnt"); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
37 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
38 gaim_prefs_add_none("/gaim/gnt/plugins"); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
39 gaim_prefs_add_string_list("/gaim/gnt/plugins/loaded", NULL); |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
40 |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
41 gaim_prefs_add_none("/gaim/gnt/conversations"); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
42 gaim_prefs_add_bool("/gaim/gnt/conversations/timestamps", TRUE); |
14065
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
43 gaim_prefs_add_bool("/gaim/gnt/conversations/notify_typing", FALSE); /* XXX: Not functional yet */ |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
44 } |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
45 |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
46 typedef struct |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
47 { |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
48 GaimPrefType type; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
49 const char *pref; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
50 const char *label; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
51 GList *(*lv)(); /* If the value is to be selected from a number of choices */ |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
52 } Prefs; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
53 |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
54 static GList * |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
55 get_log_options() |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
56 { |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
57 return gaim_log_logger_get_options(); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
58 } |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
59 |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
60 static GaimRequestField * |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
61 get_pref_field(Prefs *prefs) |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
62 { |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
63 GaimRequestField *field = NULL; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
64 |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
65 if (prefs->lv == NULL) |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
66 { |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
67 switch (prefs->type) |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
68 { |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
69 case GAIM_PREF_BOOLEAN: |
14198
c65ed4f6eea8
[gaim-migrate @ 16870]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
70 field = gaim_request_field_bool_new(prefs->pref, _(prefs->label), |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
71 gaim_prefs_get_bool(prefs->pref)); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
72 break; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
73 case GAIM_PREF_INT: |
14198
c65ed4f6eea8
[gaim-migrate @ 16870]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
74 field = gaim_request_field_int_new(prefs->pref, _(prefs->label), |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
75 gaim_prefs_get_int(prefs->pref)); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
76 break; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
77 case GAIM_PREF_STRING: |
14198
c65ed4f6eea8
[gaim-migrate @ 16870]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
78 field = gaim_request_field_string_new(prefs->pref, _(prefs->label), |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
79 gaim_prefs_get_string(prefs->pref), FALSE); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
80 break; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
81 default: |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
82 break; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
83 } |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
84 } |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
85 else |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
86 { |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
87 GList *list = prefs->lv(), *iter; |
14198
c65ed4f6eea8
[gaim-migrate @ 16870]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
88 field = gaim_request_field_list_new(prefs->pref, _(prefs->label)); |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
89 for (iter = list; iter; iter = iter->next) |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
90 { |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
91 gboolean select = FALSE; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
92 const char *data = iter->data; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
93 iter = iter->next; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
94 switch (prefs->type) |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
95 { |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
96 case GAIM_PREF_BOOLEAN: |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
97 if (gaim_prefs_get_bool(prefs->pref) == GPOINTER_TO_INT(iter->data)) |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
98 select = TRUE; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
99 break; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
100 case GAIM_PREF_INT: |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
101 if (gaim_prefs_get_int(prefs->pref) == GPOINTER_TO_INT(iter->data)) |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
102 select = TRUE; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
103 break; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
104 case GAIM_PREF_STRING: |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
105 if (strcmp(gaim_prefs_get_string(prefs->pref), iter->data) == 0) |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
106 select = TRUE; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
107 break; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
108 default: |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
109 break; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
110 } |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
111 gaim_request_field_list_add(field, data, iter->data); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
112 if (select) |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
113 gaim_request_field_list_add_selected(field, data); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
114 } |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
115 g_list_free(list); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
116 } |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
117 return field; |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
118 } |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
119 |
14065
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
120 static Prefs blist[] = |
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
121 { |
14198
c65ed4f6eea8
[gaim-migrate @ 16870]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
122 {GAIM_PREF_BOOLEAN, "/gaim/gnt/blist/idletime", N_("Show Idle Time"), NULL}, |
14399
28baa42b5ac2
[gaim-migrate @ 17107]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14198
diff
changeset
|
123 {GAIM_PREF_BOOLEAN, "/gaim/gnt/blist/showoffline", N_("Show Offline Buddies"), NULL}, |
14065
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
124 {GAIM_PREF_NONE, NULL, NULL, NULL} |
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
125 }; |
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
126 |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
127 static Prefs convs[] = |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
128 { |
14198
c65ed4f6eea8
[gaim-migrate @ 16870]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
129 {GAIM_PREF_BOOLEAN, "/gaim/gnt/conversations/timestamps", N_("Show Timestamps"), NULL}, |
c65ed4f6eea8
[gaim-migrate @ 16870]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
130 {GAIM_PREF_BOOLEAN, "/gaim/gnt/conversations/notify_typing", N_("Notify buddies when you are typing"), NULL}, |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
131 {GAIM_PREF_NONE, NULL, NULL, NULL} |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
132 }; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
133 |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
134 static Prefs logging[] = |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
135 { |
14198
c65ed4f6eea8
[gaim-migrate @ 16870]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
136 {GAIM_PREF_STRING, "/core/logging/format", N_("Log format"), get_log_options}, |
c65ed4f6eea8
[gaim-migrate @ 16870]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
137 {GAIM_PREF_BOOLEAN, "/core/logging/log_ims", N_("Log IMs"), NULL}, |
c65ed4f6eea8
[gaim-migrate @ 16870]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
138 {GAIM_PREF_BOOLEAN, "/core/logging/log_chats", N_("Log chats"), NULL}, |
c65ed4f6eea8
[gaim-migrate @ 16870]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
139 {GAIM_PREF_BOOLEAN, "/core/logging/log_system", N_("Log status change events"), NULL}, |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
140 {GAIM_PREF_NONE, NULL, NULL, NULL}, |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
141 }; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
142 |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
143 static void |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
144 save_cb(void *data, GaimRequestFields *allfields) |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
145 { |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
146 GList *list; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
147 for (list = gaim_request_fields_get_groups(allfields); list; list = list->next) |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
148 { |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
149 GaimRequestFieldGroup *group = list->data; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
150 GList *fields = gaim_request_field_group_get_fields(group); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
151 |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
152 for (; fields ; fields = fields->next) |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
153 { |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
154 GaimRequestField *field = fields->data; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
155 GaimRequestFieldType type = gaim_request_field_get_type(field); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
156 GaimPrefType pt; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
157 gpointer val = NULL; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
158 const char *id = gaim_request_field_get_id(field); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
159 |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
160 switch (type) |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
161 { |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
162 case GAIM_REQUEST_FIELD_LIST: |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
163 val = gaim_request_field_list_get_selected(field)->data; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
164 break; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
165 case GAIM_REQUEST_FIELD_BOOLEAN: |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
166 val = GINT_TO_POINTER(gaim_request_field_bool_get_value(field)); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
167 break; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
168 case GAIM_REQUEST_FIELD_INTEGER: |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
169 val = GINT_TO_POINTER(gaim_request_field_int_get_value(field)); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
170 break; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
171 case GAIM_REQUEST_FIELD_STRING: |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
172 val = (gpointer)gaim_request_field_string_get_value(field); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
173 break; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
174 default: |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
175 break; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
176 } |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
177 |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
178 pt = gaim_prefs_get_type(id); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
179 switch (pt) |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
180 { |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
181 case GAIM_PREF_INT: |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
182 gaim_prefs_set_int(id, GPOINTER_TO_INT(val)); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
183 break; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
184 case GAIM_PREF_BOOLEAN: |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
185 gaim_prefs_set_bool(id, GPOINTER_TO_INT(val)); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
186 break; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
187 case GAIM_PREF_STRING: |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
188 gaim_prefs_set_string(id, val); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
189 break; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
190 default: |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
191 break; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
192 } |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
193 } |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
194 } |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
195 } |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
196 |
14065
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
197 static void |
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
198 add_pref_group(GaimRequestFields *fields, const char *title, Prefs *prefs) |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
199 { |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
200 GaimRequestField *field; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
201 GaimRequestFieldGroup *group; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
202 int i; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
203 |
14065
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
204 group = gaim_request_field_group_new(title); |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
205 gaim_request_fields_add_group(fields, group); |
14065
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
206 for (i = 0; prefs[i].pref; i++) |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
207 { |
14065
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
208 field = get_pref_field(prefs + i); |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
209 gaim_request_field_group_add_field(group, field); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
210 } |
14065
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
211 } |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
212 |
14065
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
213 void gg_prefs_show_all() |
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
214 { |
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
215 GaimRequestFields *fields; |
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
216 |
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
217 fields = gaim_request_fields_new(); |
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
218 |
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
219 add_pref_group(fields, _("Buddy List"), blist); |
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
220 add_pref_group(fields, _("Conversations"), convs); |
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
221 add_pref_group(fields, _("Logging"), logging); |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
222 |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
223 gaim_request_fields(NULL, _("Preferences"), NULL, NULL, fields, |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
224 _("Save"), G_CALLBACK(save_cb), _("Cancel"), NULL, NULL); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
225 } |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
226 |