annotate console/gntprefs.c @ 14218:c509b8b8a646

[gaim-migrate @ 16899] I miscalculated the default 80x24 height of the blist by the window list. committer: Tailor Script <tailor@pidgin.im>
author Ethan Blanton <elb@pidgin.im>
date Sun, 20 Aug 2006 14:02:43 +0000
parents c65ed4f6eea8
children 28baa42b5ac2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13983
b7a99d54a5a9 [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
1 #include <prefs.h>
b7a99d54a5a9 [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
2
14059
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
3 #include "gntgaim.h"
13983
b7a99d54a5a9 [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
4 #include "gntprefs.h"
14059
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
5 #include "gntrequest.h"
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
6
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
7 #include <string.h>
13983
b7a99d54a5a9 [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
8
b7a99d54a5a9 [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
9 void gg_prefs_init()
b7a99d54a5a9 [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
10 {
b7a99d54a5a9 [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
11 gaim_prefs_add_none("/gaim");
b7a99d54a5a9 [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
12 gaim_prefs_add_none("/gaim/gnt");
b7a99d54a5a9 [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
13
b7a99d54a5a9 [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
14 gaim_prefs_add_none("/gaim/gnt/plugins");
b7a99d54a5a9 [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
15 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
16
14065
8ef994bacf3d [gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
17 gaim_prefs_add_none("/gaim/gnt/blist");
8ef994bacf3d [gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
18 gaim_prefs_add_bool("/gaim/gnt/blist/idletime", TRUE);
8ef994bacf3d [gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
19
14059
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
20 gaim_prefs_add_none("/gaim/gnt/conversations");
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
21 gaim_prefs_add_bool("/gaim/gnt/conversations/timestamps", TRUE);
14065
8ef994bacf3d [gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
22 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
23 }
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
24
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
25 typedef struct
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
26 {
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
27 GaimPrefType type;
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
28 const char *pref;
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
29 const char *label;
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
30 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
31 } Prefs;
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
32
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
33 static GList *
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
34 get_log_options()
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
35 {
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
36 return gaim_log_logger_get_options();
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
37 }
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
38
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
39 static GaimRequestField *
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
40 get_pref_field(Prefs *prefs)
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
41 {
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
42 GaimRequestField *field = NULL;
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 if (prefs->lv == NULL)
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 switch (prefs->type)
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 case GAIM_PREF_BOOLEAN:
14198
c65ed4f6eea8 [gaim-migrate @ 16870]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14065
diff changeset
49 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
50 gaim_prefs_get_bool(prefs->pref));
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
51 break;
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
52 case GAIM_PREF_INT:
14198
c65ed4f6eea8 [gaim-migrate @ 16870]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14065
diff changeset
53 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
54 gaim_prefs_get_int(prefs->pref));
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
55 break;
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
56 case GAIM_PREF_STRING:
14198
c65ed4f6eea8 [gaim-migrate @ 16870]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14065
diff changeset
57 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
58 gaim_prefs_get_string(prefs->pref), FALSE);
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
59 break;
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
60 default:
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
61 break;
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 }
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
64 else
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
65 {
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
66 GList *list = prefs->lv(), *iter;
14198
c65ed4f6eea8 [gaim-migrate @ 16870]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14065
diff changeset
67 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
68 for (iter = list; iter; iter = iter->next)
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
69 {
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
70 gboolean select = FALSE;
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
71 const char *data = iter->data;
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
72 iter = iter->next;
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
73 switch (prefs->type)
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
74 {
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
75 case GAIM_PREF_BOOLEAN:
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
76 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
77 select = TRUE;
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
78 break;
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
79 case GAIM_PREF_INT:
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
80 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
81 select = TRUE;
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 case GAIM_PREF_STRING:
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
84 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
85 select = TRUE;
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
86 break;
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
87 default:
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
88 break;
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
89 }
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
90 gaim_request_field_list_add(field, data, iter->data);
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
91 if (select)
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
92 gaim_request_field_list_add_selected(field, data);
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
93 }
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
94 g_list_free(list);
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 return field;
13983
b7a99d54a5a9 [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
97 }
b7a99d54a5a9 [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
98
14065
8ef994bacf3d [gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
99 static Prefs blist[] =
8ef994bacf3d [gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
100 {
14198
c65ed4f6eea8 [gaim-migrate @ 16870]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14065
diff changeset
101 {GAIM_PREF_BOOLEAN, "/gaim/gnt/blist/idletime", N_("Show Idle Time"), NULL},
14065
8ef994bacf3d [gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
102 {GAIM_PREF_NONE, NULL, NULL, NULL}
8ef994bacf3d [gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
103 };
8ef994bacf3d [gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
104
14059
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
105 static Prefs convs[] =
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
106 {
14198
c65ed4f6eea8 [gaim-migrate @ 16870]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14065
diff changeset
107 {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
108 {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
109 {GAIM_PREF_NONE, NULL, NULL, NULL}
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
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
112 static Prefs logging[] =
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
113 {
14198
c65ed4f6eea8 [gaim-migrate @ 16870]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14065
diff changeset
114 {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
115 {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
116 {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
117 {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
118 {GAIM_PREF_NONE, NULL, NULL, NULL},
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
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
121 static void
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
122 save_cb(void *data, GaimRequestFields *allfields)
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
123 {
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
124 GList *list;
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
125 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
126 {
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
127 GaimRequestFieldGroup *group = list->data;
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
128 GList *fields = gaim_request_field_group_get_fields(group);
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
129
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
130 for (; fields ; fields = fields->next)
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
131 {
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
132 GaimRequestField *field = fields->data;
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
133 GaimRequestFieldType type = gaim_request_field_get_type(field);
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
134 GaimPrefType pt;
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
135 gpointer val = NULL;
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
136 const char *id = gaim_request_field_get_id(field);
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
137
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
138 switch (type)
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
139 {
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
140 case GAIM_REQUEST_FIELD_LIST:
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
141 val = gaim_request_field_list_get_selected(field)->data;
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
142 break;
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
143 case GAIM_REQUEST_FIELD_BOOLEAN:
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
144 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
145 break;
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
146 case GAIM_REQUEST_FIELD_INTEGER:
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
147 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
148 break;
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
149 case GAIM_REQUEST_FIELD_STRING:
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
150 val = (gpointer)gaim_request_field_string_get_value(field);
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
151 break;
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
152 default:
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
153 break;
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
154 }
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
155
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
156 pt = gaim_prefs_get_type(id);
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
157 switch (pt)
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
158 {
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
159 case GAIM_PREF_INT:
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
160 gaim_prefs_set_int(id, GPOINTER_TO_INT(val));
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
161 break;
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
162 case GAIM_PREF_BOOLEAN:
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
163 gaim_prefs_set_bool(id, GPOINTER_TO_INT(val));
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_PREF_STRING:
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
166 gaim_prefs_set_string(id, val);
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 default:
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
169 break;
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 }
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
172 }
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
173 }
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
174
14065
8ef994bacf3d [gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
175 static void
8ef994bacf3d [gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
176 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
177 {
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
178 GaimRequestField *field;
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
179 GaimRequestFieldGroup *group;
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
180 int i;
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
181
14065
8ef994bacf3d [gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
182 group = gaim_request_field_group_new(title);
14059
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
183 gaim_request_fields_add_group(fields, group);
14065
8ef994bacf3d [gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
184 for (i = 0; prefs[i].pref; i++)
14059
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
185 {
14065
8ef994bacf3d [gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
186 field = get_pref_field(prefs + i);
14059
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
187 gaim_request_field_group_add_field(group, field);
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
188 }
14065
8ef994bacf3d [gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
189 }
14059
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
190
14065
8ef994bacf3d [gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
191 void gg_prefs_show_all()
8ef994bacf3d [gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
192 {
8ef994bacf3d [gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
193 GaimRequestFields *fields;
8ef994bacf3d [gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
194
8ef994bacf3d [gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
195 fields = gaim_request_fields_new();
8ef994bacf3d [gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
196
8ef994bacf3d [gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
197 add_pref_group(fields, _("Buddy List"), blist);
8ef994bacf3d [gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
198 add_pref_group(fields, _("Conversations"), convs);
8ef994bacf3d [gaim-migrate @ 16686]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
199 add_pref_group(fields, _("Logging"), logging);
14059
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 gaim_request_fields(NULL, _("Preferences"), NULL, NULL, fields,
2d1b41e3cf0d [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13983
diff changeset
202 _("Save"), G_CALLBACK(save_cb), _("Cancel"), NULL, NULL);
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