Fri, 16 Sep 2022 01:54:11 -0500
Change the credential provider row active indicator to a CheckButton
Because I noticed that Adw has a style that is for this sort of thing.
Testing Done:
Opened Credential prefs, and changed selected provider. Also checked that clicking the check button didn't accidentally change its state without changing the row, and that it could not be selected by keyboard separately from the row.
Reviewed at https://reviews.imfreedom.org/r/1775/
|
20147
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
1 | /* pidgin |
| 8713 | 2 | * |
|
15931
716b5fac1895
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
3 | * Pidgin is the legal property of its developers, whose names are too numerous |
| 8713 | 4 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 5 | * source distribution. | |
| 6 | * | |
| 7 | * This program is free software; you can redistribute it and/or modify | |
| 8 | * it under the terms of the GNU General Public License as published by | |
| 9 | * the Free Software Foundation; either version 2 of the License, or | |
| 10 | * (at your option) any later version. | |
| 11 | * | |
| 12 | * This program is distributed in the hope that it will be useful, | |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 | * GNU General Public License for more details. | |
| 16 | * | |
| 17 | * You should have received a copy of the GNU General Public License | |
| 18 | * 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
|
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 8713 | 20 | */ |
|
39227
291b3c800668
Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents:
38007
diff
changeset
|
21 | #include <talkatu.h> |
|
291b3c800668
Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents:
38007
diff
changeset
|
22 | |
|
40360
e21f3bbcc2a5
Update all of the pidgin code to include purple.h
Gary Kramlich <grim@reaperworld.com>
parents:
40197
diff
changeset
|
23 | #include <purple.h> |
| 8713 | 24 | |
| 25 | #include "gtkpluginpref.h" | |
| 26 | #include "gtkutils.h" | |
|
40886
198bf5bc58ce
Move Pidgin preferences code into a subdirectory.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40490
diff
changeset
|
27 | #include "pidginprefs.h" |
| 8713 | 28 | |
| 29 | static gboolean | |
| 30 | entry_cb(GtkWidget *entry, gpointer data) { | |
| 31 | char *pref = data; | |
| 32 | ||
|
41531
2b86501d13fe
Replace gtk_entry_[gs]et_text with gtk_editable_[gs]et_text
Gary Kramlich <grim@reaperworld.com>
parents:
40886
diff
changeset
|
33 | purple_prefs_set_string(pref, gtk_editable_get_text(GTK_EDITABLE(entry))); |
| 8713 | 34 | |
| 35 | return FALSE; | |
| 36 | } | |
| 37 | ||
|
12712
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11986
diff
changeset
|
38 | |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11986
diff
changeset
|
39 | static void |
|
39229
f2c79c2fc99f
Correct a signal connection and comment out a broken one with a warning to fix it when talkatu has a solution for it
Gary Kramlich <grim@reaperworld.com>
parents:
39228
diff
changeset
|
40 | multiline_cb(GtkTextBuffer *buffer, gpointer data) { |
|
39227
291b3c800668
Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents:
38007
diff
changeset
|
41 | gchar *pref = NULL, *text = NULL; |
|
12712
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11986
diff
changeset
|
42 | |
|
39229
f2c79c2fc99f
Correct a signal connection and comment out a broken one with a warning to fix it when talkatu has a solution for it
Gary Kramlich <grim@reaperworld.com>
parents:
39228
diff
changeset
|
43 | pref = g_object_get_data(G_OBJECT(buffer), "pref-key"); |
|
12712
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11986
diff
changeset
|
44 | g_return_if_fail(pref); |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11986
diff
changeset
|
45 | |
|
39227
291b3c800668
Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents:
38007
diff
changeset
|
46 | text = talkatu_markup_get_html(buffer, NULL); |
| 15884 | 47 | purple_prefs_set_string(pref, text); |
|
12712
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11986
diff
changeset
|
48 | g_free(text); |
|
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 | |
| 8713 | 51 | static void |
| 15884 | 52 | make_string_pref(GtkWidget *parent, PurplePluginPref *pref, GtkSizeGroup *sg) { |
|
13107
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12794
diff
changeset
|
53 | GtkWidget *box, *gtk_label, *entry; |
|
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12794
diff
changeset
|
54 | const gchar *pref_name; |
|
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12794
diff
changeset
|
55 | const gchar *pref_label; |
| 15884 | 56 | PurpleStringFormatType format; |
| 8713 | 57 | |
| 15884 | 58 | pref_name = purple_plugin_pref_get_name(pref); |
| 59 | pref_label = purple_plugin_pref_get_label(pref); | |
| 60 | format = purple_plugin_pref_get_format_type(pref); | |
| 8713 | 61 | |
|
35378
5d9e2581005b
gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents:
34274
diff
changeset
|
62 | switch(purple_plugin_pref_get_pref_type(pref)) { |
| 15884 | 63 | case PURPLE_PLUGIN_PREF_CHOICE: |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
64 | gtk_label = pidgin_prefs_dropdown_from_list(parent, pref_label, |
| 15884 | 65 | PURPLE_PREF_STRING, pref_name, |
| 66 | purple_plugin_pref_get_choices(pref)); | |
|
38007
3b971d2ecae1
Simplify gtk_label_set_[xy]align calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37990
diff
changeset
|
67 | gtk_label_set_xalign(GTK_LABEL(gtk_label), 0); |
| 8713 | 68 | |
| 69 | if(sg) | |
| 70 | gtk_size_group_add_widget(sg, gtk_label); | |
| 71 | ||
| 72 | break; | |
| 15884 | 73 | case PURPLE_PLUGIN_PREF_NONE: |
| 8713 | 74 | default: |
| 15884 | 75 | if (format == PURPLE_STRING_FORMAT_TYPE_NONE) |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
25457
diff
changeset
|
76 | { |
|
12712
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11986
diff
changeset
|
77 | entry = gtk_entry_new(); |
|
41531
2b86501d13fe
Replace gtk_entry_[gs]et_text with gtk_editable_[gs]et_text
Gary Kramlich <grim@reaperworld.com>
parents:
40886
diff
changeset
|
78 | gtk_editable_set_text(GTK_EDITABLE(entry), purple_prefs_get_string(pref_name)); |
|
12712
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11986
diff
changeset
|
79 | gtk_entry_set_max_length(GTK_ENTRY(entry), |
| 15884 | 80 | purple_plugin_pref_get_max_length(pref)); |
| 81 | if (purple_plugin_pref_get_masked(pref)) | |
|
12712
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11986
diff
changeset
|
82 | { |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11986
diff
changeset
|
83 | gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11986
diff
changeset
|
84 | } |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11986
diff
changeset
|
85 | g_signal_connect(G_OBJECT(entry), "changed", |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11986
diff
changeset
|
86 | G_CALLBACK(entry_cb), |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11986
diff
changeset
|
87 | (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
|
88 | 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
|
89 | } |
|
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11986
diff
changeset
|
90 | else |
|
11986
21d2ab6421a7
[gaim-migrate @ 14279]
Mark Doliner <markdoliner@pidgin.im>
parents:
11243
diff
changeset
|
91 | { |
|
13107
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12794
diff
changeset
|
92 | GtkWidget *hbox; |
|
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12794
diff
changeset
|
93 | GtkWidget *spacer; |
|
39227
291b3c800668
Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents:
38007
diff
changeset
|
94 | GtkWidget *editor; |
|
40484
7df95db772d8
Update a a few things that were changed in talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
95 | GtkWidget *input; |
|
39227
291b3c800668
Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents:
38007
diff
changeset
|
96 | GtkTextBuffer *buffer; |
|
13107
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12794
diff
changeset
|
97 | |
|
40490
fb6e46c4c63c
Remove PIDGIN_HIG_* constants
Gary Kramlich <grim@reaperworld.com>
parents:
40484
diff
changeset
|
98 | box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6); |
|
22139
f0f4a10114ea
An additional push from Gabriel's omgp.pidgin.add-widget-util branch.
Ethan Blanton <elb@pidgin.im>
parents:
20289
diff
changeset
|
99 | |
|
f0f4a10114ea
An additional push from Gabriel's omgp.pidgin.add-widget-util branch.
Ethan Blanton <elb@pidgin.im>
parents:
20289
diff
changeset
|
100 | gtk_widget_show(box); |
|
41533
bca738fd139b
Convert PidginPluginPref to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41531
diff
changeset
|
101 | gtk_box_append(GTK_BOX(parent), box); |
|
22139
f0f4a10114ea
An additional push from Gabriel's omgp.pidgin.add-widget-util branch.
Ethan Blanton <elb@pidgin.im>
parents:
20289
diff
changeset
|
102 | |
|
f0f4a10114ea
An additional push from Gabriel's omgp.pidgin.add-widget-util branch.
Ethan Blanton <elb@pidgin.im>
parents:
20289
diff
changeset
|
103 | gtk_label = gtk_label_new_with_mnemonic(pref_label); |
|
38007
3b971d2ecae1
Simplify gtk_label_set_[xy]align calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37990
diff
changeset
|
104 | gtk_label_set_xalign(GTK_LABEL(gtk_label), 0); |
|
22139
f0f4a10114ea
An additional push from Gabriel's omgp.pidgin.add-widget-util branch.
Ethan Blanton <elb@pidgin.im>
parents:
20289
diff
changeset
|
105 | gtk_widget_show(gtk_label); |
|
41533
bca738fd139b
Convert PidginPluginPref to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41531
diff
changeset
|
106 | gtk_box_append(GTK_BOX(box), gtk_label); |
|
22139
f0f4a10114ea
An additional push from Gabriel's omgp.pidgin.add-widget-util branch.
Ethan Blanton <elb@pidgin.im>
parents:
20289
diff
changeset
|
107 | |
|
f0f4a10114ea
An additional push from Gabriel's omgp.pidgin.add-widget-util branch.
Ethan Blanton <elb@pidgin.im>
parents:
20289
diff
changeset
|
108 | if(sg) |
|
f0f4a10114ea
An additional push from Gabriel's omgp.pidgin.add-widget-util branch.
Ethan Blanton <elb@pidgin.im>
parents:
20289
diff
changeset
|
109 | 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
|
110 | |
|
40490
fb6e46c4c63c
Remove PIDGIN_HIG_* constants
Gary Kramlich <grim@reaperworld.com>
parents:
40484
diff
changeset
|
111 | hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); |
|
41533
bca738fd139b
Convert PidginPluginPref to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41531
diff
changeset
|
112 | gtk_box_append(GTK_BOX(box), hbox); |
|
13107
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12794
diff
changeset
|
113 | gtk_widget_show(hbox); |
|
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12794
diff
changeset
|
114 | |
|
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12794
diff
changeset
|
115 | spacer = gtk_label_new(" "); |
|
41533
bca738fd139b
Convert PidginPluginPref to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41531
diff
changeset
|
116 | gtk_box_append(GTK_BOX(hbox), spacer); |
|
13107
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12794
diff
changeset
|
117 | gtk_widget_show(spacer); |
|
12712
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11986
diff
changeset
|
118 | |
|
39227
291b3c800668
Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents:
38007
diff
changeset
|
119 | editor = talkatu_editor_new(); |
|
40484
7df95db772d8
Update a a few things that were changed in talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
120 | input = talkatu_editor_get_input(TALKATU_EDITOR(editor)); |
|
39227
291b3c800668
Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents:
38007
diff
changeset
|
121 | |
|
34274
9169710b5af5
Hide GtkWebViewToolbar stuff within the GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33683
diff
changeset
|
122 | if ((format & PURPLE_STRING_FORMAT_TYPE_HTML) != 0) { |
|
39228
d8b87c16c8a6
Use the correct buffers for multiline/html
Gary Kramlich <grim@reaperworld.com>
parents:
39227
diff
changeset
|
123 | buffer = talkatu_html_buffer_new(); |
|
34274
9169710b5af5
Hide GtkWebViewToolbar stuff within the GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33683
diff
changeset
|
124 | } else { |
|
39228
d8b87c16c8a6
Use the correct buffers for multiline/html
Gary Kramlich <grim@reaperworld.com>
parents:
39227
diff
changeset
|
125 | buffer = talkatu_buffer_new(NULL); |
|
33252
abcaf61b570d
Disable formatting if the pluginpref doesn't allow HTML.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33199
diff
changeset
|
126 | } |
|
12712
21ea46d3dee9
[gaim-migrate @ 15056]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11986
diff
changeset
|
127 | |
|
40484
7df95db772d8
Update a a few things that were changed in talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
128 | gtk_text_view_set_buffer(GTK_TEXT_VIEW(input), buffer); |
|
39227
291b3c800668
Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents:
38007
diff
changeset
|
129 | |
|
33199
e82a9f0fa7ec
Convert plugin prefs to GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
130 | if (format & PURPLE_STRING_FORMAT_TYPE_MULTILINE) { |
|
e82a9f0fa7ec
Convert plugin prefs to GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
131 | gchar *tmp = purple_strreplace(purple_prefs_get_string(pref_name), "\n", "<br>"); |
|
39227
291b3c800668
Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents:
38007
diff
changeset
|
132 | talkatu_markup_set_html(TALKATU_BUFFER(buffer), tmp, -1); |
|
33199
e82a9f0fa7ec
Convert plugin prefs to GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
133 | g_free(tmp); |
|
39227
291b3c800668
Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents:
38007
diff
changeset
|
134 | } else { |
|
291b3c800668
Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents:
38007
diff
changeset
|
135 | talkatu_markup_set_html(TALKATU_BUFFER(buffer), purple_prefs_get_string(pref_name), -1); |
|
291b3c800668
Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents:
38007
diff
changeset
|
136 | } |
|
291b3c800668
Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents:
38007
diff
changeset
|
137 | |
|
40484
7df95db772d8
Update a a few things that were changed in talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
138 | gtk_label_set_mnemonic_widget(GTK_LABEL(gtk_label), input); |
|
39229
f2c79c2fc99f
Correct a signal connection and comment out a broken one with a warning to fix it when talkatu has a solution for it
Gary Kramlich <grim@reaperworld.com>
parents:
39228
diff
changeset
|
139 | g_object_set_data(G_OBJECT(buffer), "pref-key", (gpointer)pref_name); |
|
f2c79c2fc99f
Correct a signal connection and comment out a broken one with a warning to fix it when talkatu has a solution for it
Gary Kramlich <grim@reaperworld.com>
parents:
39228
diff
changeset
|
140 | g_signal_connect(G_OBJECT(buffer), "changed", |
|
39227
291b3c800668
Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents:
38007
diff
changeset
|
141 | G_CALLBACK(multiline_cb), NULL); |
|
39229
f2c79c2fc99f
Correct a signal connection and comment out a broken one with a warning to fix it when talkatu has a solution for it
Gary Kramlich <grim@reaperworld.com>
parents:
39228
diff
changeset
|
142 | #warning fix this when talkatu has a solution |
|
f2c79c2fc99f
Correct a signal connection and comment out a broken one with a warning to fix it when talkatu has a solution for it
Gary Kramlich <grim@reaperworld.com>
parents:
39228
diff
changeset
|
143 | /* |
|
39227
291b3c800668
Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents:
38007
diff
changeset
|
144 | g_signal_connect(G_OBJECT(view), "format-toggled", |
|
291b3c800668
Move GtkPluginPref to use Talkatu instead of Webkit
Gary Kramlich <grim@reaperworld.com>
parents:
38007
diff
changeset
|
145 | G_CALLBACK(multiline_cb), NULL); |
|
39229
f2c79c2fc99f
Correct a signal connection and comment out a broken one with a warning to fix it when talkatu has a solution for it
Gary Kramlich <grim@reaperworld.com>
parents:
39228
diff
changeset
|
146 | */ |
|
41533
bca738fd139b
Convert PidginPluginPref to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41531
diff
changeset
|
147 | gtk_box_append(GTK_BOX(hbox), editor); |
|
bca738fd139b
Convert PidginPluginPref to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41531
diff
changeset
|
148 | gtk_widget_set_hexpand(editor, TRUE); |
|
11986
21d2ab6421a7
[gaim-migrate @ 14279]
Mark Doliner <markdoliner@pidgin.im>
parents:
11243
diff
changeset
|
149 | } |
| 8713 | 150 | |
| 151 | break; | |
| 152 | } | |
| 153 | } | |
| 154 | ||
| 155 | static void | |
| 15884 | 156 | make_int_pref(GtkWidget *parent, PurplePluginPref *pref, GtkSizeGroup *sg) { |
| 8713 | 157 | GtkWidget *gtk_label; |
|
13107
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12794
diff
changeset
|
158 | const gchar *pref_name; |
|
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12794
diff
changeset
|
159 | const gchar *pref_label; |
| 8713 | 160 | gint max, min; |
| 161 | ||
| 15884 | 162 | pref_name = purple_plugin_pref_get_name(pref); |
| 163 | pref_label = purple_plugin_pref_get_label(pref); | |
| 8713 | 164 | |
|
35378
5d9e2581005b
gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents:
34274
diff
changeset
|
165 | switch(purple_plugin_pref_get_pref_type(pref)) { |
| 15884 | 166 | case PURPLE_PLUGIN_PREF_CHOICE: |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
167 | gtk_label = pidgin_prefs_dropdown_from_list(parent, pref_label, |
| 15884 | 168 | PURPLE_PREF_INT, pref_name, purple_plugin_pref_get_choices(pref)); |
|
38007
3b971d2ecae1
Simplify gtk_label_set_[xy]align calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37990
diff
changeset
|
169 | gtk_label_set_xalign(GTK_LABEL(gtk_label), 0); |
| 8713 | 170 | |
| 171 | if(sg) | |
| 172 | gtk_size_group_add_widget(sg, gtk_label); | |
| 173 | ||
| 174 | break; | |
| 15884 | 175 | case PURPLE_PLUGIN_PREF_NONE: |
| 8713 | 176 | default: |
| 15884 | 177 | 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
|
178 | pidgin_prefs_labeled_spin_button(parent, pref_label, |
|
9529
377b70382202
[gaim-migrate @ 10356]
Christopher O'Brien <siege@pidgin.im>
parents:
8713
diff
changeset
|
179 | pref_name, min, max, sg); |
| 8713 | 180 | break; |
| 181 | } | |
| 182 | } | |
| 183 | ||
|
9529
377b70382202
[gaim-migrate @ 10356]
Christopher O'Brien <siege@pidgin.im>
parents:
8713
diff
changeset
|
184 | |
|
377b70382202
[gaim-migrate @ 10356]
Christopher O'Brien <siege@pidgin.im>
parents:
8713
diff
changeset
|
185 | static void |
| 15884 | 186 | make_info_pref(GtkWidget *parent, PurplePluginPref *pref) { |
| 187 | GtkWidget *gtk_label = gtk_label_new(purple_plugin_pref_get_label(pref)); | |
|
38007
3b971d2ecae1
Simplify gtk_label_set_[xy]align calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37990
diff
changeset
|
188 | gtk_label_set_xalign(GTK_LABEL(gtk_label), 0); |
|
3b971d2ecae1
Simplify gtk_label_set_[xy]align calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37990
diff
changeset
|
189 | gtk_label_set_yalign(GTK_LABEL(gtk_label), 0); |
|
41533
bca738fd139b
Convert PidginPluginPref to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41531
diff
changeset
|
190 | gtk_label_set_wrap(GTK_LABEL(gtk_label), TRUE); |
|
bca738fd139b
Convert PidginPluginPref to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41531
diff
changeset
|
191 | gtk_box_append(GTK_BOX(parent), gtk_label); |
|
9529
377b70382202
[gaim-migrate @ 10356]
Christopher O'Brien <siege@pidgin.im>
parents:
8713
diff
changeset
|
192 | gtk_widget_show(gtk_label); |
|
377b70382202
[gaim-migrate @ 10356]
Christopher O'Brien <siege@pidgin.im>
parents:
8713
diff
changeset
|
193 | } |
|
377b70382202
[gaim-migrate @ 10356]
Christopher O'Brien <siege@pidgin.im>
parents:
8713
diff
changeset
|
194 | |
|
377b70382202
[gaim-migrate @ 10356]
Christopher O'Brien <siege@pidgin.im>
parents:
8713
diff
changeset
|
195 | |
| 8713 | 196 | GtkWidget * |
| 15884 | 197 | pidgin_plugin_pref_create_frame(PurplePluginPrefFrame *frame) { |
| 8713 | 198 | GtkWidget *ret, *parent; |
| 199 | GtkSizeGroup *sg; | |
| 200 | GList *pp; | |
| 201 | ||
| 202 | g_return_val_if_fail(frame, NULL); | |
| 203 | ||
| 204 | sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
| 205 | ||
|
35527
707c3c2b2c8a
Fix more gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35500
diff
changeset
|
206 | parent = ret = gtk_box_new(GTK_ORIENTATION_VERTICAL, 16); |
| 8713 | 207 | gtk_widget_show(ret); |
| 208 | ||
| 15884 | 209 | for(pp = purple_plugin_pref_frame_get_prefs(frame); |
| 8713 | 210 | pp != NULL; |
| 211 | pp = pp->next) | |
| 212 | { | |
| 15884 | 213 | PurplePluginPref *pref = (PurplePluginPref *)pp->data; |
| 8713 | 214 | |
| 15884 | 215 | const char *name = purple_plugin_pref_get_name(pref); |
| 216 | const char *label = purple_plugin_pref_get_label(pref); | |
| 8713 | 217 | |
| 218 | if(name == NULL) { | |
| 219 | if(label == NULL) | |
| 220 | continue; | |
|
9529
377b70382202
[gaim-migrate @ 10356]
Christopher O'Brien <siege@pidgin.im>
parents:
8713
diff
changeset
|
221 | |
|
35378
5d9e2581005b
gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents:
34274
diff
changeset
|
222 | if(purple_plugin_pref_get_pref_type(pref) == PURPLE_PLUGIN_PREF_INFO) { |
|
9529
377b70382202
[gaim-migrate @ 10356]
Christopher O'Brien <siege@pidgin.im>
parents:
8713
diff
changeset
|
223 | make_info_pref(parent, pref); |
|
377b70382202
[gaim-migrate @ 10356]
Christopher O'Brien <siege@pidgin.im>
parents:
8713
diff
changeset
|
224 | } else { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
225 | parent = pidgin_make_frame(ret, label); |
|
9529
377b70382202
[gaim-migrate @ 10356]
Christopher O'Brien <siege@pidgin.im>
parents:
8713
diff
changeset
|
226 | gtk_widget_show(parent); |
|
377b70382202
[gaim-migrate @ 10356]
Christopher O'Brien <siege@pidgin.im>
parents:
8713
diff
changeset
|
227 | } |
| 8713 | 228 | |
| 229 | continue; | |
| 230 | } | |
| 231 | ||
|
35378
5d9e2581005b
gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents:
34274
diff
changeset
|
232 | switch(purple_prefs_get_pref_type(name)) { |
| 15884 | 233 | case PURPLE_PREF_BOOLEAN: |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
234 | pidgin_prefs_checkbox(label, name, parent); |
| 8713 | 235 | break; |
| 15884 | 236 | case PURPLE_PREF_INT: |
| 8713 | 237 | make_int_pref(parent, pref, sg); |
| 238 | break; | |
| 15884 | 239 | case PURPLE_PREF_STRING: |
| 8713 | 240 | make_string_pref(parent, pref, sg); |
| 241 | break; | |
| 242 | default: | |
| 243 | break; | |
| 244 | } | |
| 245 | } | |
| 246 | ||
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20147
diff
changeset
|
247 | g_object_unref(sg); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20147
diff
changeset
|
248 | |
| 8713 | 249 | return ret; |
| 250 | } |