Mercurial > pidgin
annotate console/gntprefs.c @ 15814:1c8f1dc50685
Enable DEBUG_CFLAGS in libgnt and fix up a number of compile warnings and
errors this showed up
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Sun, 18 Mar 2007 17:28:21 +0000 |
parents | 0e9bcdeaf2fa |
children |
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> |
15757
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
26 #include <savedstatuses.h> |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
27 |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
28 #include "gntgaim.h" |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
29 #include "gntprefs.h" |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
30 #include "gntrequest.h" |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
31 |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
32 #include <string.h> |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
33 |
15757
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
34 static GList *freestrings; /* strings to be freed when the pref-window is closed */ |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
35 |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
36 void gg_prefs_init() |
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"); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
39 gaim_prefs_add_none("/gaim/gnt"); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
40 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
41 gaim_prefs_add_none("/gaim/gnt/plugins"); |
15325 | 42 gaim_prefs_add_path_list("/gaim/gnt/plugins/loaded", NULL); |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
43 |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
44 gaim_prefs_add_none("/gaim/gnt/conversations"); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
45 gaim_prefs_add_bool("/gaim/gnt/conversations/timestamps", TRUE); |
14065
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
46 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
|
47 } |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
48 |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
49 typedef struct |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
50 { |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
51 GaimPrefType type; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
52 const char *pref; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
53 const char *label; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
54 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
|
55 } Prefs; |
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 static GList * |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
58 get_log_options() |
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 return gaim_log_logger_get_options(); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
61 } |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
62 |
15757
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
63 static GList * |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
64 get_idle_options() |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
65 { |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
66 GList *list = NULL; |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
67 list = g_list_append(list, "Based on keyboard use"); /* XXX: string freeze */ |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
68 list = g_list_append(list, "system"); |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
69 list = g_list_append(list, (char*)_("From last sent message")); |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
70 list = g_list_append(list, "gaim"); |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
71 list = g_list_append(list, (char*)_("Never")); |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
72 list = g_list_append(list, "never"); |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
73 return list; |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
74 } |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
75 |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
76 static GList * |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
77 get_status_titles() |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
78 { |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
79 GList *list = NULL; |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
80 const GList *iter; |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
81 for (iter = gaim_savedstatuses_get_all(); iter; iter = iter->next) { |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
82 char *str; |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
83 if (gaim_savedstatus_is_transient(iter->data)) |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
84 continue; |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
85 str = g_strdup_printf("%ld", gaim_savedstatus_get_creation_time(iter->data)); |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
86 list = g_list_append(list, (char*)gaim_savedstatus_get_title(iter->data)); |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
87 list = g_list_append(list, str); |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
88 freestrings = g_list_prepend(freestrings, str); |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
89 } |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
90 return list; |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
91 } |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
92 |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
93 static GaimRequestField * |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
94 get_pref_field(Prefs *prefs) |
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 GaimRequestField *field = NULL; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
97 |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
98 if (prefs->lv == NULL) |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
99 { |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
100 switch (prefs->type) |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
101 { |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
102 case GAIM_PREF_BOOLEAN: |
14198
c65ed4f6eea8
[gaim-migrate @ 16870]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
103 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
|
104 gaim_prefs_get_bool(prefs->pref)); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
105 break; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
106 case GAIM_PREF_INT: |
14198
c65ed4f6eea8
[gaim-migrate @ 16870]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
107 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
|
108 gaim_prefs_get_int(prefs->pref)); |
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 case GAIM_PREF_STRING: |
14198
c65ed4f6eea8
[gaim-migrate @ 16870]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
111 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
|
112 gaim_prefs_get_string(prefs->pref), FALSE); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
113 break; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
114 default: |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
115 break; |
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 } |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
118 else |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
119 { |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
120 GList *list = prefs->lv(), *iter; |
15757
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
121 if (list) |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
122 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
|
123 for (iter = list; iter; iter = iter->next) |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
124 { |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
125 gboolean select = FALSE; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
126 const char *data = iter->data; |
15757
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
127 int idata; |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
128 iter = iter->next; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
129 switch (prefs->type) |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
130 { |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
131 case GAIM_PREF_BOOLEAN: |
15757
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
132 sscanf(iter->data, "%d", &idata); |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
133 if (gaim_prefs_get_bool(prefs->pref) == idata) |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
134 select = TRUE; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
135 break; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
136 case GAIM_PREF_INT: |
15757
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
137 sscanf(iter->data, "%d", &idata); |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
138 if (gaim_prefs_get_int(prefs->pref) == idata) |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
139 select = TRUE; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
140 break; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
141 case GAIM_PREF_STRING: |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
142 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
|
143 select = TRUE; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
144 break; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
145 default: |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
146 break; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
147 } |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
148 gaim_request_field_list_add(field, data, iter->data); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
149 if (select) |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
150 gaim_request_field_list_add_selected(field, data); |
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 g_list_free(list); |
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 return field; |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
155 } |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
156 |
14065
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
157 static Prefs blist[] = |
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
158 { |
14198
c65ed4f6eea8
[gaim-migrate @ 16870]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
159 {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
|
160 {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
|
161 {GAIM_PREF_NONE, NULL, NULL, NULL} |
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
162 }; |
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
163 |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
164 static Prefs convs[] = |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
165 { |
14198
c65ed4f6eea8
[gaim-migrate @ 16870]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
166 {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
|
167 {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
|
168 {GAIM_PREF_NONE, NULL, NULL, NULL} |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
169 }; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
170 |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
171 static Prefs logging[] = |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
172 { |
14198
c65ed4f6eea8
[gaim-migrate @ 16870]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14065
diff
changeset
|
173 {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
|
174 {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
|
175 {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
|
176 {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
|
177 {GAIM_PREF_NONE, NULL, NULL, NULL}, |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
178 }; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
179 |
15757
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
180 /* XXX: Translate after the freeze */ |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
181 static Prefs idle[] = |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
182 { |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
183 {GAIM_PREF_STRING, "/core/away/idle_reporting", "Report Idle time", get_idle_options}, |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
184 {GAIM_PREF_BOOLEAN, "/core/away/away_when_idle", "Change status when idle", NULL}, |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
185 {GAIM_PREF_INT, "/core/away/mins_before_away", "Minutes before changing status", NULL}, |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
186 {GAIM_PREF_INT, "/core/savedstatus/idleaway", "Change status to", get_status_titles}, |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
187 {GAIM_PREF_NONE, NULL, NULL, NULL}, |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
188 }; |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
189 |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
190 static void |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
191 free_strings() |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
192 { |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
193 g_list_foreach(freestrings, (GFunc)g_free, NULL); |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
194 g_list_free(freestrings); |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
195 freestrings = NULL; |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
196 } |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
197 |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
198 static void |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
199 save_cb(void *data, GaimRequestFields *allfields) |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
200 { |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
201 GList *list; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
202 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
|
203 { |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
204 GaimRequestFieldGroup *group = list->data; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
205 GList *fields = gaim_request_field_group_get_fields(group); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
206 |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
207 for (; fields ; fields = fields->next) |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
208 { |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
209 GaimRequestField *field = fields->data; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
210 GaimRequestFieldType type = gaim_request_field_get_type(field); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
211 GaimPrefType pt; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
212 gpointer val = NULL; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
213 const char *id = gaim_request_field_get_id(field); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
214 |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
215 switch (type) |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
216 { |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
217 case GAIM_REQUEST_FIELD_LIST: |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
218 val = gaim_request_field_list_get_selected(field)->data; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
219 break; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
220 case GAIM_REQUEST_FIELD_BOOLEAN: |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
221 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
|
222 break; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
223 case GAIM_REQUEST_FIELD_INTEGER: |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
224 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
|
225 break; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
226 case GAIM_REQUEST_FIELD_STRING: |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
227 val = (gpointer)gaim_request_field_string_get_value(field); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
228 break; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
229 default: |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
230 break; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
231 } |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
232 |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
233 pt = gaim_prefs_get_type(id); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
234 switch (pt) |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
235 { |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
236 case GAIM_PREF_INT: |
15757
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
237 if (type == GAIM_REQUEST_FIELD_LIST) /* Lists always return string */ |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
238 sscanf(val, "%ld", (long int *)&val); |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
239 gaim_prefs_set_int(id, GPOINTER_TO_INT(val)); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
240 break; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
241 case GAIM_PREF_BOOLEAN: |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
242 gaim_prefs_set_bool(id, GPOINTER_TO_INT(val)); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
243 break; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
244 case GAIM_PREF_STRING: |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
245 gaim_prefs_set_string(id, val); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
246 break; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
247 default: |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
248 break; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
249 } |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
250 } |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
251 } |
15757
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
252 free_strings(); |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
253 } |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
254 |
14065
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
255 static void |
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
256 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
|
257 { |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
258 GaimRequestField *field; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
259 GaimRequestFieldGroup *group; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
260 int i; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
261 |
14065
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
262 group = gaim_request_field_group_new(title); |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
263 gaim_request_fields_add_group(fields, group); |
14065
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
264 for (i = 0; prefs[i].pref; i++) |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
265 { |
14065
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
266 field = get_pref_field(prefs + i); |
15757
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
267 if (field) |
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
268 gaim_request_field_group_add_field(group, field); |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
269 } |
14065
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
270 } |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
271 |
14065
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
272 void gg_prefs_show_all() |
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
273 { |
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
274 GaimRequestFields *fields; |
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
275 |
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
276 fields = gaim_request_fields_new(); |
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
277 |
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
278 add_pref_group(fields, _("Buddy List"), blist); |
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
279 add_pref_group(fields, _("Conversations"), convs); |
8ef994bacf3d
[gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
280 add_pref_group(fields, _("Logging"), logging); |
15757
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
281 add_pref_group(fields, _("Idle"), idle); |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
282 |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
283 gaim_request_fields(NULL, _("Preferences"), NULL, NULL, fields, |
15757
0e9bcdeaf2fa
Preference for idleness. Someone was looking for this thing.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15325
diff
changeset
|
284 _("Save"), G_CALLBACK(save_cb), _("Cancel"), free_strings, NULL); |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
285 } |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
286 |