Fri, 23 Aug 2013 15:07:32 +0530
Merged default branch
| 8713 | 1 | /** |
| 10297 | 2 | * @file gtkpluginpref.c GTK+ Plugin preferences |
|
16254
eeb2bba4dc94
Rename the Doxygen group from gtkui to pidgin.
Richard Laager <rlaager@pidgin.im>
parents:
15931
diff
changeset
|
3 | * @ingroup pidgin |
|
20147
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
4 | */ |
|
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
5 | |
|
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
6 | /* pidgin |
| 8713 | 7 | * |
|
15931
716b5fac1895
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
8 | * Pidgin is the legal property of its developers, whose names are too numerous |
| 8713 | 9 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 10 | * source distribution. | |
| 11 | * | |
| 12 | * This program is free software; you can redistribute it and/or modify | |
| 13 | * it under the terms of the GNU General Public License as published by | |
| 14 | * the Free Software Foundation; either version 2 of the License, or | |
| 15 | * (at your option) any later version. | |
| 16 | * | |
| 17 | * This program is distributed in the hope that it will be useful, | |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 20 | * GNU General Public License for more details. | |
| 21 | * | |
| 22 | * You should have received a copy of the GNU General Public License | |
| 23 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
16254
diff
changeset
|
24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 8713 | 25 | */ |
| 26 | #ifdef HAVE_CONFIG_H | |
| 27 | # include <config.h> | |
| 28 | #endif | |
| 29 | ||
| 30 | #include "debug.h" | |
| 31 | #include "internal.h" | |
| 32 | #include "pluginpref.h" | |
| 33 | #include "prefs.h" | |
| 34 | ||
| 35 | #include "gtkpluginpref.h" | |
| 36 | #include "gtkprefs.h" | |
| 37 | #include "gtkutils.h" | |
|
33199
e82a9f0fa7ec
Convert plugin prefs to GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
38 | #include "gtkwebview.h" |
| 8713 | 39 | |
| 40 | static gboolean | |
| 41 | entry_cb(GtkWidget *entry, gpointer data) { | |
| 42 | char *pref = data; | |
| 43 | ||
| 15884 | 44 | purple_prefs_set_string(pref, gtk_entry_get_text(GTK_ENTRY(entry))); |
| 8713 | 45 | |
| 46 | return FALSE; | |
| 47 | } | |
| 48 | ||
|
12712
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11986
diff
changeset
|
49 | |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11986
diff
changeset
|
50 | static void |
|
33199
e82a9f0fa7ec
Convert plugin prefs to GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
51 | webview_cb(GtkWebView *webview, gpointer data) |
|
12712
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11986
diff
changeset
|
52 | { |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11986
diff
changeset
|
53 | char *pref; |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11986
diff
changeset
|
54 | char *text; |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11986
diff
changeset
|
55 | |
|
33199
e82a9f0fa7ec
Convert plugin prefs to GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
56 | pref = g_object_get_data(G_OBJECT(webview), "pref-key"); |
|
12712
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11986
diff
changeset
|
57 | g_return_if_fail(pref); |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11986
diff
changeset
|
58 | |
|
33199
e82a9f0fa7ec
Convert plugin prefs to GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
59 | text = gtk_webview_get_body_html(webview); |
| 15884 | 60 | purple_prefs_set_string(pref, text); |
|
12712
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11986
diff
changeset
|
61 | g_free(text); |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11986
diff
changeset
|
62 | } |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11986
diff
changeset
|
63 | |
| 8713 | 64 | static void |
| 15884 | 65 | make_string_pref(GtkWidget *parent, PurplePluginPref *pref, GtkSizeGroup *sg) { |
|
13107
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12794
diff
changeset
|
66 | GtkWidget *box, *gtk_label, *entry; |
|
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12794
diff
changeset
|
67 | const gchar *pref_name; |
|
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12794
diff
changeset
|
68 | const gchar *pref_label; |
| 15884 | 69 | PurpleStringFormatType format; |
| 8713 | 70 | |
| 15884 | 71 | pref_name = purple_plugin_pref_get_name(pref); |
| 72 | pref_label = purple_plugin_pref_get_label(pref); | |
| 73 | format = purple_plugin_pref_get_format_type(pref); | |
| 8713 | 74 | |
| 15884 | 75 | switch(purple_plugin_pref_get_type(pref)) { |
| 76 | case PURPLE_PLUGIN_PREF_CHOICE: | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
77 | gtk_label = pidgin_prefs_dropdown_from_list(parent, pref_label, |
| 15884 | 78 | PURPLE_PREF_STRING, pref_name, |
| 79 | purple_plugin_pref_get_choices(pref)); | |
| 8713 | 80 | gtk_misc_set_alignment(GTK_MISC(gtk_label), 0, 0.5); |
| 81 | ||
| 82 | if(sg) | |
| 83 | gtk_size_group_add_widget(sg, gtk_label); | |
| 84 | ||
| 85 | break; | |
| 15884 | 86 | case PURPLE_PLUGIN_PREF_NONE: |
| 8713 | 87 | default: |
| 15884 | 88 | if (format == PURPLE_STRING_FORMAT_TYPE_NONE) |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
25457
diff
changeset
|
89 | { |
|
12712
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11986
diff
changeset
|
90 | entry = gtk_entry_new(); |
| 15884 | 91 | gtk_entry_set_text(GTK_ENTRY(entry), purple_prefs_get_string(pref_name)); |
|
12712
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11986
diff
changeset
|
92 | gtk_entry_set_max_length(GTK_ENTRY(entry), |
| 15884 | 93 | purple_plugin_pref_get_max_length(pref)); |
| 94 | if (purple_plugin_pref_get_masked(pref)) | |
|
12712
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11986
diff
changeset
|
95 | { |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11986
diff
changeset
|
96 | gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11986
diff
changeset
|
97 | } |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11986
diff
changeset
|
98 | g_signal_connect(G_OBJECT(entry), "changed", |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11986
diff
changeset
|
99 | G_CALLBACK(entry_cb), |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11986
diff
changeset
|
100 | (gpointer)pref_name); |
|
22139
f0f4a10114ea
An additional push from Gabriel's omgp.pidgin.add-widget-util branch.
Ethan Blanton <elb@pidgin.im>
parents:
20289
diff
changeset
|
101 | pidgin_add_widget_to_vbox(GTK_BOX(parent), pref_label, sg, entry, TRUE, NULL); |
|
12712
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11986
diff
changeset
|
102 | } |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11986
diff
changeset
|
103 | else |
|
11986
21d2ab6421a7
[gaim-migrate @ 14279]
Mark Doliner <markdoliner@pidgin.im>
parents:
11243
diff
changeset
|
104 | { |
|
13107
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12794
diff
changeset
|
105 | GtkWidget *hbox; |
|
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12794
diff
changeset
|
106 | GtkWidget *spacer; |
|
33199
e82a9f0fa7ec
Convert plugin prefs to GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
107 | GtkWidget *webview; |
|
13107
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12794
diff
changeset
|
108 | GtkWidget *frame; |
|
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12794
diff
changeset
|
109 | |
|
22139
f0f4a10114ea
An additional push from Gabriel's omgp.pidgin.add-widget-util branch.
Ethan Blanton <elb@pidgin.im>
parents:
20289
diff
changeset
|
110 | box = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
|
f0f4a10114ea
An additional push from Gabriel's omgp.pidgin.add-widget-util branch.
Ethan Blanton <elb@pidgin.im>
parents:
20289
diff
changeset
|
111 | |
|
f0f4a10114ea
An additional push from Gabriel's omgp.pidgin.add-widget-util branch.
Ethan Blanton <elb@pidgin.im>
parents:
20289
diff
changeset
|
112 | gtk_widget_show(box); |
|
f0f4a10114ea
An additional push from Gabriel's omgp.pidgin.add-widget-util branch.
Ethan Blanton <elb@pidgin.im>
parents:
20289
diff
changeset
|
113 | gtk_box_pack_start(GTK_BOX(parent), box, FALSE, FALSE, 0); |
|
f0f4a10114ea
An additional push from Gabriel's omgp.pidgin.add-widget-util branch.
Ethan Blanton <elb@pidgin.im>
parents:
20289
diff
changeset
|
114 | |
|
f0f4a10114ea
An additional push from Gabriel's omgp.pidgin.add-widget-util branch.
Ethan Blanton <elb@pidgin.im>
parents:
20289
diff
changeset
|
115 | gtk_label = gtk_label_new_with_mnemonic(pref_label); |
|
f0f4a10114ea
An additional push from Gabriel's omgp.pidgin.add-widget-util branch.
Ethan Blanton <elb@pidgin.im>
parents:
20289
diff
changeset
|
116 | gtk_misc_set_alignment(GTK_MISC(gtk_label), 0, 0.5); |
|
f0f4a10114ea
An additional push from Gabriel's omgp.pidgin.add-widget-util branch.
Ethan Blanton <elb@pidgin.im>
parents:
20289
diff
changeset
|
117 | gtk_widget_show(gtk_label); |
|
f0f4a10114ea
An additional push from Gabriel's omgp.pidgin.add-widget-util branch.
Ethan Blanton <elb@pidgin.im>
parents:
20289
diff
changeset
|
118 | gtk_box_pack_start(GTK_BOX(box), gtk_label, FALSE, FALSE, 0); |
|
f0f4a10114ea
An additional push from Gabriel's omgp.pidgin.add-widget-util branch.
Ethan Blanton <elb@pidgin.im>
parents:
20289
diff
changeset
|
119 | |
|
f0f4a10114ea
An additional push from Gabriel's omgp.pidgin.add-widget-util branch.
Ethan Blanton <elb@pidgin.im>
parents:
20289
diff
changeset
|
120 | if(sg) |
|
f0f4a10114ea
An additional push from Gabriel's omgp.pidgin.add-widget-util branch.
Ethan Blanton <elb@pidgin.im>
parents:
20289
diff
changeset
|
121 | gtk_size_group_add_widget(sg, gtk_label); |
|
f0f4a10114ea
An additional push from Gabriel's omgp.pidgin.add-widget-util branch.
Ethan Blanton <elb@pidgin.im>
parents:
20289
diff
changeset
|
122 | |
| 15882 | 123 | hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
|
13107
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12794
diff
changeset
|
124 | gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0); |
|
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12794
diff
changeset
|
125 | gtk_widget_show(hbox); |
|
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12794
diff
changeset
|
126 | |
|
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12794
diff
changeset
|
127 | spacer = gtk_label_new(" "); |
|
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12794
diff
changeset
|
128 | gtk_box_pack_start(GTK_BOX(hbox), spacer, FALSE, FALSE, 0); |
|
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12794
diff
changeset
|
129 | gtk_widget_show(spacer); |
|
12712
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11986
diff
changeset
|
130 | |
|
34274
9169710b5af5
Hide GtkWebViewToolbar stuff within the GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33683
diff
changeset
|
131 | if ((format & PURPLE_STRING_FORMAT_TYPE_HTML) != 0) { |
|
9169710b5af5
Hide GtkWebViewToolbar stuff within the GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33683
diff
changeset
|
132 | frame = pidgin_create_webview(TRUE, &webview, NULL); |
|
9169710b5af5
Hide GtkWebViewToolbar stuff within the GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33683
diff
changeset
|
133 | } else { |
|
9169710b5af5
Hide GtkWebViewToolbar stuff within the GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33683
diff
changeset
|
134 | frame = pidgin_create_webview(FALSE, &webview, NULL); |
|
33252
abcaf61b570d
Disable formatting if the pluginpref doesn't allow HTML.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33199
diff
changeset
|
135 | gtk_webview_set_format_functions(GTK_WEBVIEW(webview), 0); |
|
abcaf61b570d
Disable formatting if the pluginpref doesn't allow HTML.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33199
diff
changeset
|
136 | } |
|
12712
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11986
diff
changeset
|
137 | |
|
33199
e82a9f0fa7ec
Convert plugin prefs to GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
138 | if (format & PURPLE_STRING_FORMAT_TYPE_MULTILINE) { |
|
e82a9f0fa7ec
Convert plugin prefs to GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
139 | gchar *tmp = purple_strreplace(purple_prefs_get_string(pref_name), "\n", "<br>"); |
|
e82a9f0fa7ec
Convert plugin prefs to GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
140 | gtk_webview_append_html(GTK_WEBVIEW(webview), tmp); |
|
e82a9f0fa7ec
Convert plugin prefs to GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
141 | g_free(tmp); |
|
e82a9f0fa7ec
Convert plugin prefs to GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
142 | } else |
|
e82a9f0fa7ec
Convert plugin prefs to GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
143 | gtk_webview_append_html(GTK_WEBVIEW(webview), purple_prefs_get_string(pref_name)); |
|
e82a9f0fa7ec
Convert plugin prefs to GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
144 | gtk_label_set_mnemonic_widget(GTK_LABEL(gtk_label), webview); |
|
12712
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11986
diff
changeset
|
145 | gtk_widget_show_all(frame); |
|
33199
e82a9f0fa7ec
Convert plugin prefs to GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
146 | g_object_set_data(G_OBJECT(webview), "pref-key", (gpointer)pref_name); |
|
e82a9f0fa7ec
Convert plugin prefs to GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
147 | g_signal_connect(G_OBJECT(webview), "changed", |
|
e82a9f0fa7ec
Convert plugin prefs to GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
148 | G_CALLBACK(webview_cb), NULL); |
|
e82a9f0fa7ec
Convert plugin prefs to GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
149 | g_signal_connect(G_OBJECT(webview), "format-toggled", |
|
e82a9f0fa7ec
Convert plugin prefs to GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
150 | G_CALLBACK(webview_cb), NULL); |
| 14937 | 151 | gtk_box_pack_start(GTK_BOX(hbox), frame, TRUE, TRUE, 0); |
|
11986
21d2ab6421a7
[gaim-migrate @ 14279]
Mark Doliner <markdoliner@pidgin.im>
parents:
11243
diff
changeset
|
152 | } |
| 8713 | 153 | |
| 154 | break; | |
| 155 | } | |
| 156 | } | |
| 157 | ||
| 158 | static void | |
| 15884 | 159 | make_int_pref(GtkWidget *parent, PurplePluginPref *pref, GtkSizeGroup *sg) { |
| 8713 | 160 | GtkWidget *gtk_label; |
|
13107
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12794
diff
changeset
|
161 | const gchar *pref_name; |
|
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12794
diff
changeset
|
162 | const gchar *pref_label; |
| 8713 | 163 | gint max, min; |
| 164 | ||
| 15884 | 165 | pref_name = purple_plugin_pref_get_name(pref); |
| 166 | pref_label = purple_plugin_pref_get_label(pref); | |
| 8713 | 167 | |
| 15884 | 168 | switch(purple_plugin_pref_get_type(pref)) { |
| 169 | case PURPLE_PLUGIN_PREF_CHOICE: | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
170 | gtk_label = pidgin_prefs_dropdown_from_list(parent, pref_label, |
| 15884 | 171 | PURPLE_PREF_INT, pref_name, purple_plugin_pref_get_choices(pref)); |
| 8713 | 172 | gtk_misc_set_alignment(GTK_MISC(gtk_label), 0, 0.5); |
| 173 | ||
| 174 | if(sg) | |
| 175 | gtk_size_group_add_widget(sg, gtk_label); | |
| 176 | ||
| 177 | break; | |
| 15884 | 178 | case PURPLE_PLUGIN_PREF_NONE: |
| 8713 | 179 | default: |
| 15884 | 180 | purple_plugin_pref_get_bounds(pref, &min, &max); |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
181 | pidgin_prefs_labeled_spin_button(parent, pref_label, |
|
9529
377b70382202
[gaim-migrate @ 10356]
Christopher O'Brien <siege@pidgin.im>
parents:
8713
diff
changeset
|
182 | pref_name, min, max, sg); |
| 8713 | 183 | break; |
| 184 | } | |
| 185 | } | |
| 186 | ||
|
9529
377b70382202
[gaim-migrate @ 10356]
Christopher O'Brien <siege@pidgin.im>
parents:
8713
diff
changeset
|
187 | |
|
377b70382202
[gaim-migrate @ 10356]
Christopher O'Brien <siege@pidgin.im>
parents:
8713
diff
changeset
|
188 | static void |
| 15884 | 189 | make_info_pref(GtkWidget *parent, PurplePluginPref *pref) { |
| 190 | GtkWidget *gtk_label = gtk_label_new(purple_plugin_pref_get_label(pref)); | |
|
9529
377b70382202
[gaim-migrate @ 10356]
Christopher O'Brien <siege@pidgin.im>
parents:
8713
diff
changeset
|
191 | gtk_misc_set_alignment(GTK_MISC(gtk_label), 0, 0); |
|
377b70382202
[gaim-migrate @ 10356]
Christopher O'Brien <siege@pidgin.im>
parents:
8713
diff
changeset
|
192 | gtk_label_set_line_wrap(GTK_LABEL(gtk_label), TRUE); |
|
377b70382202
[gaim-migrate @ 10356]
Christopher O'Brien <siege@pidgin.im>
parents:
8713
diff
changeset
|
193 | gtk_box_pack_start(GTK_BOX(parent), gtk_label, FALSE, FALSE, 0); |
|
377b70382202
[gaim-migrate @ 10356]
Christopher O'Brien <siege@pidgin.im>
parents:
8713
diff
changeset
|
194 | gtk_widget_show(gtk_label); |
|
377b70382202
[gaim-migrate @ 10356]
Christopher O'Brien <siege@pidgin.im>
parents:
8713
diff
changeset
|
195 | } |
|
377b70382202
[gaim-migrate @ 10356]
Christopher O'Brien <siege@pidgin.im>
parents:
8713
diff
changeset
|
196 | |
|
377b70382202
[gaim-migrate @ 10356]
Christopher O'Brien <siege@pidgin.im>
parents:
8713
diff
changeset
|
197 | |
| 8713 | 198 | GtkWidget * |
| 15884 | 199 | pidgin_plugin_pref_create_frame(PurplePluginPrefFrame *frame) { |
| 8713 | 200 | GtkWidget *ret, *parent; |
| 201 | GtkSizeGroup *sg; | |
| 202 | GList *pp; | |
| 203 | ||
| 204 | g_return_val_if_fail(frame, NULL); | |
| 205 | ||
| 206 | sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
| 207 | ||
| 208 | parent = ret = gtk_vbox_new(FALSE, 16); | |
|
33170
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33141
diff
changeset
|
209 | #if !GTK_CHECK_VERSION(3,0,0) |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33141
diff
changeset
|
210 | gtk_container_set_border_width(GTK_CONTAINER(ret), PIDGIN_HIG_BORDER); |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33141
diff
changeset
|
211 | #endif |
| 8713 | 212 | gtk_widget_show(ret); |
| 213 | ||
| 15884 | 214 | for(pp = purple_plugin_pref_frame_get_prefs(frame); |
| 8713 | 215 | pp != NULL; |
| 216 | pp = pp->next) | |
| 217 | { | |
| 15884 | 218 | PurplePluginPref *pref = (PurplePluginPref *)pp->data; |
| 8713 | 219 | |
| 15884 | 220 | const char *name = purple_plugin_pref_get_name(pref); |
| 221 | const char *label = purple_plugin_pref_get_label(pref); | |
| 8713 | 222 | |
| 223 | if(name == NULL) { | |
| 224 | if(label == NULL) | |
| 225 | continue; | |
|
9529
377b70382202
[gaim-migrate @ 10356]
Christopher O'Brien <siege@pidgin.im>
parents:
8713
diff
changeset
|
226 | |
| 15884 | 227 | if(purple_plugin_pref_get_type(pref) == PURPLE_PLUGIN_PREF_INFO) { |
|
9529
377b70382202
[gaim-migrate @ 10356]
Christopher O'Brien <siege@pidgin.im>
parents:
8713
diff
changeset
|
228 | make_info_pref(parent, pref); |
|
377b70382202
[gaim-migrate @ 10356]
Christopher O'Brien <siege@pidgin.im>
parents:
8713
diff
changeset
|
229 | } else { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
230 | parent = pidgin_make_frame(ret, label); |
|
9529
377b70382202
[gaim-migrate @ 10356]
Christopher O'Brien <siege@pidgin.im>
parents:
8713
diff
changeset
|
231 | gtk_widget_show(parent); |
|
377b70382202
[gaim-migrate @ 10356]
Christopher O'Brien <siege@pidgin.im>
parents:
8713
diff
changeset
|
232 | } |
| 8713 | 233 | |
| 234 | continue; | |
| 235 | } | |
| 236 | ||
| 15884 | 237 | switch(purple_prefs_get_type(name)) { |
| 238 | case PURPLE_PREF_BOOLEAN: | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
239 | pidgin_prefs_checkbox(label, name, parent); |
| 8713 | 240 | break; |
| 15884 | 241 | case PURPLE_PREF_INT: |
| 8713 | 242 | make_int_pref(parent, pref, sg); |
| 243 | break; | |
| 15884 | 244 | case PURPLE_PREF_STRING: |
| 8713 | 245 | make_string_pref(parent, pref, sg); |
| 246 | break; | |
| 247 | default: | |
| 248 | break; | |
| 249 | } | |
| 250 | } | |
| 251 | ||
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20147
diff
changeset
|
252 | g_object_unref(sg); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20147
diff
changeset
|
253 | |
| 8713 | 254 | return ret; |
| 255 | } |