annotate src/gtkpluginpref.c @ 10973:65c56b8490c5

[gaim-migrate @ 12798] sf patch #1213669, from Michael R Head "Vertically center pref labels for dropdowns" committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 06 Jun 2005 02:40:01 +0000
parents 26eac2362c32
children a511b77a368b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8713
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
1 /**
10297
ec140184437b [gaim-migrate @ 11480]
Luke Schierer <lschiere@pidgin.im>
parents: 9841
diff changeset
2 * @file gtkpluginpref.c GTK+ Plugin preferences
ec140184437b [gaim-migrate @ 11480]
Luke Schierer <lschiere@pidgin.im>
parents: 9841
diff changeset
3 * @ingroup gtkui
ec140184437b [gaim-migrate @ 11480]
Luke Schierer <lschiere@pidgin.im>
parents: 9841
diff changeset
4 *
8713
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
5 * gaim
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
6 *
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
7 * Gaim is the legal property of its developers, whose names are too numerous
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
8 * to list here. Please refer to the COPYRIGHT file distributed with this
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
9 * source distribution.
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
10 *
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
14 * (at your option) any later version.
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
15 *
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
16 * This program is distributed in the hope that it will be useful,
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
19 * GNU General Public License for more details.
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
20 *
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
21 * You should have received a copy of the GNU General Public License
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
22 * along with this program; if not, write to the Free Software
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
24 */
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
25 #ifdef HAVE_CONFIG_H
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
26 # include <config.h>
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
27 #endif
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
28
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
29 #include "debug.h"
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
30 #include "internal.h"
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
31 #include "pluginpref.h"
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
32 #include "prefs.h"
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
33
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
34 #include "gtkpluginpref.h"
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
35 #include "gtkprefs.h"
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
36 #include "gtkutils.h"
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
37
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
38 static gboolean
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
39 entry_cb(GtkWidget *entry, gpointer data) {
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
40 char *pref = data;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
41
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
42 gaim_prefs_set_string(pref, gtk_entry_get_text(GTK_ENTRY(entry)));
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
43
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
44 return FALSE;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
45 }
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
46
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
47 static void
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
48 make_string_pref(GtkWidget *parent, GaimPluginPref *pref, GtkSizeGroup *sg) {
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
49 GtkWidget *hbox, *gtk_label, *entry;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
50 gchar *pref_name, *pref_label;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
51
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
52 pref_name = gaim_plugin_pref_get_name(pref);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
53 pref_label = gaim_plugin_pref_get_label(pref);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
54
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
55 switch(gaim_plugin_pref_get_type(pref)) {
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
56 case GAIM_PLUGIN_PREF_CHOICE:
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
57 gtk_label = gaim_gtk_prefs_dropdown_from_list(parent, pref_label,
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
58 GAIM_PREF_STRING, pref_name,
10414
26eac2362c32 [gaim-migrate @ 11664]
Mark Doliner <mark@kingant.net>
parents: 10297
diff changeset
59 gaim_plugin_pref_get_choices(pref));
8713
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
60 gtk_misc_set_alignment(GTK_MISC(gtk_label), 0, 0.5);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
61
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
62 if(sg)
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
63 gtk_size_group_add_widget(sg, gtk_label);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
64
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
65 break;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
66 case GAIM_PLUGIN_PREF_NONE:
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
67 default:
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
68 hbox = gtk_hbox_new(FALSE, 6);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
69 gtk_widget_show(hbox);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
70 gtk_box_pack_start(GTK_BOX(parent), hbox, FALSE, FALSE, 0);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
71
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
72 gtk_label = gtk_label_new_with_mnemonic(pref_label);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
73 gtk_misc_set_alignment(GTK_MISC(gtk_label), 0, 0.5);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
74 gtk_widget_show(gtk_label);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
75 gtk_box_pack_start(GTK_BOX(hbox), gtk_label, FALSE, FALSE, 0);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
76
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
77 if(sg)
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
78 gtk_size_group_add_widget(sg, gtk_label);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
79
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
80 entry = gtk_entry_new();
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
81 gtk_entry_set_text(GTK_ENTRY(entry), gaim_prefs_get_string(pref_name));
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
82 gtk_entry_set_max_length(GTK_ENTRY(entry),
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
83 gaim_plugin_pref_get_max_length(pref));
9841
1ae82c0c24ee [gaim-migrate @ 10718]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
84 gtk_entry_set_visibility(GTK_ENTRY(entry),
1ae82c0c24ee [gaim-migrate @ 10718]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
85 !gaim_plugin_pref_get_masked(pref));
8713
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
86 g_signal_connect(G_OBJECT(entry), "changed",
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
87 G_CALLBACK(entry_cb),
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
88 (gpointer)pref_name);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
89 gtk_label_set_mnemonic_widget(GTK_LABEL(gtk_label), entry);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
90 gtk_widget_show(entry);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
91 gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 0);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
92
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
93 break;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
94 }
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
95 }
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
96
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
97 static void
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
98 make_int_pref(GtkWidget *parent, GaimPluginPref *pref, GtkSizeGroup *sg) {
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
99 GtkWidget *gtk_label;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
100 gchar *pref_name, *pref_label;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
101 gint max, min;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
102
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
103 pref_name = gaim_plugin_pref_get_name(pref);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
104 pref_label = gaim_plugin_pref_get_label(pref);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
105
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
106 switch(gaim_plugin_pref_get_type(pref)) {
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
107 case GAIM_PLUGIN_PREF_CHOICE:
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
108 gtk_label = gaim_gtk_prefs_dropdown_from_list(parent, pref_label,
9529
803e642650e1 [gaim-migrate @ 10356]
Luke Schierer <lschiere@pidgin.im>
parents: 8713
diff changeset
109 GAIM_PREF_INT, pref_name, gaim_plugin_pref_get_choices(pref));
8713
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
110 gtk_misc_set_alignment(GTK_MISC(gtk_label), 0, 0.5);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
111
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
112 if(sg)
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
113 gtk_size_group_add_widget(sg, gtk_label);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
114
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
115 break;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
116 case GAIM_PLUGIN_PREF_NONE:
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
117 default:
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
118 gaim_plugin_pref_get_bounds(pref, &min, &max);
10414
26eac2362c32 [gaim-migrate @ 11664]
Mark Doliner <mark@kingant.net>
parents: 10297
diff changeset
119 gaim_gtk_prefs_labeled_spin_button(parent, pref_label,
9529
803e642650e1 [gaim-migrate @ 10356]
Luke Schierer <lschiere@pidgin.im>
parents: 8713
diff changeset
120 pref_name, min, max, sg);
8713
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
121 break;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
122 }
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
123 }
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
124
9529
803e642650e1 [gaim-migrate @ 10356]
Luke Schierer <lschiere@pidgin.im>
parents: 8713
diff changeset
125
803e642650e1 [gaim-migrate @ 10356]
Luke Schierer <lschiere@pidgin.im>
parents: 8713
diff changeset
126 static void
803e642650e1 [gaim-migrate @ 10356]
Luke Schierer <lschiere@pidgin.im>
parents: 8713
diff changeset
127 make_info_pref(GtkWidget *parent, GaimPluginPref *pref) {
803e642650e1 [gaim-migrate @ 10356]
Luke Schierer <lschiere@pidgin.im>
parents: 8713
diff changeset
128 GtkWidget *gtk_label = gtk_label_new(gaim_plugin_pref_get_label(pref));
803e642650e1 [gaim-migrate @ 10356]
Luke Schierer <lschiere@pidgin.im>
parents: 8713
diff changeset
129 gtk_misc_set_alignment(GTK_MISC(gtk_label), 0, 0);
803e642650e1 [gaim-migrate @ 10356]
Luke Schierer <lschiere@pidgin.im>
parents: 8713
diff changeset
130 gtk_label_set_line_wrap(GTK_LABEL(gtk_label), TRUE);
803e642650e1 [gaim-migrate @ 10356]
Luke Schierer <lschiere@pidgin.im>
parents: 8713
diff changeset
131 gtk_box_pack_start(GTK_BOX(parent), gtk_label, FALSE, FALSE, 0);
803e642650e1 [gaim-migrate @ 10356]
Luke Schierer <lschiere@pidgin.im>
parents: 8713
diff changeset
132 gtk_widget_show(gtk_label);
803e642650e1 [gaim-migrate @ 10356]
Luke Schierer <lschiere@pidgin.im>
parents: 8713
diff changeset
133 }
803e642650e1 [gaim-migrate @ 10356]
Luke Schierer <lschiere@pidgin.im>
parents: 8713
diff changeset
134
803e642650e1 [gaim-migrate @ 10356]
Luke Schierer <lschiere@pidgin.im>
parents: 8713
diff changeset
135
8713
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
136 GtkWidget *
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
137 gaim_gtk_plugin_pref_create_frame(GaimPluginPrefFrame *frame) {
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
138 GaimPluginPref *pref;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
139 GtkWidget *ret, *parent;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
140 GtkSizeGroup *sg;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
141 GList *pp;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
142 gchar *name, *label;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
143
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
144 g_return_val_if_fail(frame, NULL);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
145
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
146 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
147
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
148 parent = ret = gtk_vbox_new(FALSE, 16);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
149 gtk_container_set_border_width(GTK_CONTAINER(ret), 12);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
150 gtk_widget_show(ret);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
151
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
152 for(pp = gaim_plugin_pref_frame_get_prefs(frame);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
153 pp != NULL;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
154 pp = pp->next)
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
155 {
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
156 pref = (GaimPluginPref *)pp->data;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
157
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
158 name = gaim_plugin_pref_get_name(pref);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
159 label = gaim_plugin_pref_get_label(pref);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
160
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
161 if(name == NULL) {
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
162 if(label == NULL)
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
163 continue;
9529
803e642650e1 [gaim-migrate @ 10356]
Luke Schierer <lschiere@pidgin.im>
parents: 8713
diff changeset
164
803e642650e1 [gaim-migrate @ 10356]
Luke Schierer <lschiere@pidgin.im>
parents: 8713
diff changeset
165 if(gaim_plugin_pref_get_type(pref) == GAIM_PLUGIN_PREF_INFO) {
803e642650e1 [gaim-migrate @ 10356]
Luke Schierer <lschiere@pidgin.im>
parents: 8713
diff changeset
166 make_info_pref(parent, pref);
803e642650e1 [gaim-migrate @ 10356]
Luke Schierer <lschiere@pidgin.im>
parents: 8713
diff changeset
167 } else {
803e642650e1 [gaim-migrate @ 10356]
Luke Schierer <lschiere@pidgin.im>
parents: 8713
diff changeset
168 parent = gaim_gtk_make_frame(ret, label);
803e642650e1 [gaim-migrate @ 10356]
Luke Schierer <lschiere@pidgin.im>
parents: 8713
diff changeset
169 gtk_widget_show(parent);
803e642650e1 [gaim-migrate @ 10356]
Luke Schierer <lschiere@pidgin.im>
parents: 8713
diff changeset
170 }
8713
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
171
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
172 continue;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
173 }
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
174
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
175 switch(gaim_prefs_get_type(name)) {
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
176 case GAIM_PREF_BOOLEAN:
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
177 gaim_gtk_prefs_checkbox(label, name, parent);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
178 break;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
179 case GAIM_PREF_INT:
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
180 make_int_pref(parent, pref, sg);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
181 break;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
182 case GAIM_PREF_STRING:
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
183 make_string_pref(parent, pref, sg);
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
184 break;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
185 default:
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
186 break;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
187 }
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
188 }
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
189
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
190 return ret;
7024b595b6ae [gaim-migrate @ 9467]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
191 }