pidgin/prefs/pidginprefs.c

Mon, 23 May 2022 22:05:35 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Mon, 23 May 2022 22:05:35 -0500
branch
gtk4
changeset 41547
a6a75a9d8a09
parent 41531
2b86501d13fe
child 41553
ec1986cf9a1e
permissions
-rw-r--r--

Update the GTK request implementation for GTK4

I had to `#if 0` a fair amount of code as it needs rewriting and there's no point in doing that now when we can't test the rewrite.

Testing Done:
Compiled

Reviewed at https://reviews.imfreedom.org/r/1414/

41397
91e5ee47f5a1 Cleanup pidgin prefs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41394
diff changeset
1 /*
91e5ee47f5a1 Cleanup pidgin prefs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41394
diff changeset
2 * Pidgin - Internet Messenger
91e5ee47f5a1 Cleanup pidgin prefs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41394
diff changeset
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
22419
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
4 *
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
5 * Pidgin is the legal property of its developers, whose names are too numerous
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
6 * to list here. Please refer to the COPYRIGHT file distributed with this
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
7 * source distribution.
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
8 *
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
9 * This program is free software; you can redistribute it and/or modify
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
10 * it under the terms of the GNU General Public License as published by
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
12 * (at your option) any later version.
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
13 *
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
14 * This program is distributed in the hope that it will be useful,
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
17 * GNU General Public License for more details.
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
18 *
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
19 * You should have received a copy of the GNU General Public License
41397
91e5ee47f5a1 Cleanup pidgin prefs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41394
diff changeset
20 * along with this program; if not, see <https://www.gnu.org/licenses/>.
22419
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
21 */
40439
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 40350
diff changeset
22
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 40350
diff changeset
23 #ifdef HAVE_CONFIG_H
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 40350
diff changeset
24 # include <config.h>
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 40350
diff changeset
25 #endif
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 40350
diff changeset
26
40462
24ed25d87550 Fix some issues on macos that resulted from the internal.h cleanup
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
27 #include <errno.h>
24ed25d87550 Fix some issues on macos that resulted from the internal.h cleanup
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
28 #include <math.h>
24ed25d87550 Fix some issues on macos that resulted from the internal.h cleanup
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
29
40439
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 40350
diff changeset
30 #include <glib/gi18n-lib.h>
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 40350
diff changeset
31 #include <glib/gstdio.h>
39264
8a7a775de597 Initial work moving gtkprefs to talkatu
Gary Kramlich <grim@reaperworld.com>
parents: 39189
diff changeset
32
40350
72271baf92bc Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents: 40333
diff changeset
33 #include <purple.h>
22419
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
34
41397
91e5ee47f5a1 Cleanup pidgin prefs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41394
diff changeset
35 #include "pidginprefs.h"
91e5ee47f5a1 Cleanup pidgin prefs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41394
diff changeset
36 #include "pidginprefsinternal.h"
22419
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
37 #include "gtkutils.h"
40496
6941fece679b phase2 of pidgin.h: move existing file to pidgincore.h
Gary Kramlich <grim@reaperworld.com>
parents: 40490
diff changeset
38 #include "pidgincore.h"
41394
1327e58acce3 Split VV prefs into a separate widget
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41390
diff changeset
39 #include "pidginvvprefs.h"
34225
3bba206f27f6 HTTP: migrate purple_util_fetch_url to new API for Pidgin UI
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34208
diff changeset
40
39178
53a96425ffc0 Start switching Preferences dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39177
diff changeset
41 struct _PidginPrefsWindow {
53a96425ffc0 Start switching Preferences dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39177
diff changeset
42 GtkDialog parent;
53a96425ffc0 Start switching Preferences dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39177
diff changeset
43 };
53a96425ffc0 Start switching Preferences dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39177
diff changeset
44
29149
773c9d17e637 Re-order variables to follow widget hierarchy.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29148
diff changeset
45 /* Main dialog */
39178
53a96425ffc0 Start switching Preferences dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39177
diff changeset
46 static PidginPrefsWindow *prefs = NULL;
22419
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
47
39178
53a96425ffc0 Start switching Preferences dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39177
diff changeset
48 G_DEFINE_TYPE(PidginPrefsWindow, pidgin_prefs_window, GTK_TYPE_DIALOG);
22419
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
49
41397
91e5ee47f5a1 Cleanup pidgin prefs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41394
diff changeset
50 /******************************************************************************
91e5ee47f5a1 Cleanup pidgin prefs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41394
diff changeset
51 * Helpers
91e5ee47f5a1 Cleanup pidgin prefs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41394
diff changeset
52 *****************************************************************************/
22419
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
53 static void
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
54 update_spin_value(GtkWidget *w, GtkWidget *spin)
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
55 {
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
56 const char *key = g_object_get_data(G_OBJECT(spin), "val");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
57 int value;
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
58
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
59 value = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin));
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
60
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
61 purple_prefs_set_int(key, value);
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
62 }
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
63
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
64 GtkWidget *
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
65 pidgin_prefs_labeled_spin_button(GtkWidget *box, const gchar *title,
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
66 const char *key, int min, int max, GtkSizeGroup *sg)
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
67 {
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
68 GtkWidget *spin;
32394
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 32391
diff changeset
69 GtkAdjustment *adjust;
22419
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
70 int val;
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
71
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
72 val = purple_prefs_get_int(key);
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
73
33172
9fb9057fc55c Fix warnings about GtkAdjustments on GTK+2.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33170
diff changeset
74 adjust = GTK_ADJUSTMENT(gtk_adjustment_new(val, min, max, 1, 1, 0));
9fb9057fc55c Fix warnings about GtkAdjustments on GTK+2.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33170
diff changeset
75 spin = gtk_spin_button_new(adjust, 1, 0);
22419
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
76 g_object_set_data(G_OBJECT(spin), "val", (char *)key);
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
77 if (max < 10000)
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
78 gtk_widget_set_size_request(spin, 50, -1);
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
79 else
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
80 gtk_widget_set_size_request(spin, 60, -1);
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
81 g_signal_connect(G_OBJECT(adjust), "value-changed",
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
82 G_CALLBACK(update_spin_value), GTK_WIDGET(spin));
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
83 gtk_widget_show(spin);
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
84
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
85 return pidgin_add_widget_to_vbox(GTK_BOX(box), title, sg, spin, FALSE, NULL);
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
86 }
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
87
41366
789f96848a43 Expose prefs binding functions internally
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41319
diff changeset
88 void
39181
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
89 pidgin_prefs_bind_spin_button(const char *key, GtkWidget *spin)
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
90 {
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
91 GtkAdjustment *adjust;
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
92 int val;
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
93
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
94 val = purple_prefs_get_int(key);
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
95
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
96 adjust = gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(spin));
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
97 gtk_adjustment_set_value(adjust, val);
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
98 g_object_set_data(G_OBJECT(spin), "val", (char *)key);
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
99 g_signal_connect(G_OBJECT(adjust), "value-changed",
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
100 G_CALLBACK(update_spin_value), GTK_WIDGET(spin));
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
101 }
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
102
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
103 static void
27493
96dc1b8abdf9 You should check the indenting before a copy & paste...
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27451
diff changeset
104 entry_set(GtkEntry *entry, gpointer data)
96dc1b8abdf9 You should check the indenting before a copy & paste...
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27451
diff changeset
105 {
22419
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
106 const char *key = (const char*)data;
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
107
41531
2b86501d13fe Replace gtk_entry_[gs]et_text with gtk_editable_[gs]et_text
Gary Kramlich <grim@reaperworld.com>
parents: 41490
diff changeset
108 purple_prefs_set_string(key, gtk_editable_get_text(GTK_EDITABLE(entry)));
22419
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
109 }
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
110
41366
789f96848a43 Expose prefs binding functions internally
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41319
diff changeset
111 void
39181
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
112 pidgin_prefs_bind_entry(const char *key, GtkWidget *entry)
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
113 {
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
114 const gchar *value;
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
115
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
116 value = purple_prefs_get_string(key);
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
117
41531
2b86501d13fe Replace gtk_entry_[gs]et_text with gtk_editable_[gs]et_text
Gary Kramlich <grim@reaperworld.com>
parents: 41490
diff changeset
118 gtk_editable_set_text(GTK_EDITABLE(entry), value);
39181
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
119 g_signal_connect(G_OBJECT(entry), "changed", G_CALLBACK(entry_set),
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
120 (char*)key);
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
121 }
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
122
22419
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
123 static void
41380
e3934b4c2950 Inline pidgin_prefs_dropdown_from_list_cb
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41371
diff changeset
124 dropdown_set(GtkComboBox *combo_box, G_GNUC_UNUSED gpointer data)
34121
797caf9ff740 pidgin_prefs_dropdown_from_list_with_cb implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34120
diff changeset
125 {
26934
988bd68379f8 Replace GtkOptionMenu with a GtkComboBox in the preferences dropdowns for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26628
diff changeset
126 GtkTreeIter iter;
988bd68379f8 Replace GtkOptionMenu with a GtkComboBox in the preferences dropdowns for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26628
diff changeset
127 GtkTreeModel *tree_model;
41380
e3934b4c2950 Inline pidgin_prefs_dropdown_from_list_cb
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41371
diff changeset
128 PurplePrefType type;
e3934b4c2950 Inline pidgin_prefs_dropdown_from_list_cb
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41371
diff changeset
129 const char *key;
34121
797caf9ff740 pidgin_prefs_dropdown_from_list_with_cb implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34120
diff changeset
130
797caf9ff740 pidgin_prefs_dropdown_from_list_with_cb implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34120
diff changeset
131 tree_model = gtk_combo_box_get_model(combo_box);
41380
e3934b4c2950 Inline pidgin_prefs_dropdown_from_list_cb
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41371
diff changeset
132 if (!gtk_combo_box_get_active_iter(combo_box, &iter)) {
32379
a983d17d92d3 With 2.7.0, we don't need these GTK_CHECK_VERSION's any more.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32378
diff changeset
133 return;
41380
e3934b4c2950 Inline pidgin_prefs_dropdown_from_list_cb
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41371
diff changeset
134 }
34130
ddd296858810 Simplify reverting dropdown changes
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34122
diff changeset
135
41380
e3934b4c2950 Inline pidgin_prefs_dropdown_from_list_cb
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41371
diff changeset
136 type = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(combo_box), "type"));
e3934b4c2950 Inline pidgin_prefs_dropdown_from_list_cb
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41371
diff changeset
137 key = g_object_get_data(G_OBJECT(combo_box), "key");
e3934b4c2950 Inline pidgin_prefs_dropdown_from_list_cb
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41371
diff changeset
138 if (type == PURPLE_PREF_INT) {
e3934b4c2950 Inline pidgin_prefs_dropdown_from_list_cb
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41371
diff changeset
139 gint value;
41390
628971e4ecdf Expose PidginPrefCombo model enum in internal API
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41388
diff changeset
140 gtk_tree_model_get(tree_model, &iter, PIDGIN_PREF_COMBO_VALUE, &value, -1);
41380
e3934b4c2950 Inline pidgin_prefs_dropdown_from_list_cb
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41371
diff changeset
141 purple_prefs_set_int(key, value);
e3934b4c2950 Inline pidgin_prefs_dropdown_from_list_cb
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41371
diff changeset
142 } else if (type == PURPLE_PREF_STRING) {
41388
4df8fa04b777 Fix leak in PidginPrefCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41387
diff changeset
143 gchar *value;
41390
628971e4ecdf Expose PidginPrefCombo model enum in internal API
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41388
diff changeset
144 gtk_tree_model_get(tree_model, &iter, PIDGIN_PREF_COMBO_VALUE, &value, -1);
41380
e3934b4c2950 Inline pidgin_prefs_dropdown_from_list_cb
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41371
diff changeset
145 purple_prefs_set_string(key, value);
41388
4df8fa04b777 Fix leak in PidginPrefCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41387
diff changeset
146 g_free(value);
41380
e3934b4c2950 Inline pidgin_prefs_dropdown_from_list_cb
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41371
diff changeset
147 } else if (type == PURPLE_PREF_BOOLEAN) {
e3934b4c2950 Inline pidgin_prefs_dropdown_from_list_cb
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41371
diff changeset
148 gboolean value;
41390
628971e4ecdf Expose PidginPrefCombo model enum in internal API
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41388
diff changeset
149 gtk_tree_model_get(tree_model, &iter, PIDGIN_PREF_COMBO_VALUE, &value, -1);
41380
e3934b4c2950 Inline pidgin_prefs_dropdown_from_list_cb
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41371
diff changeset
150 purple_prefs_set_bool(key, value);
e3934b4c2950 Inline pidgin_prefs_dropdown_from_list_cb
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41371
diff changeset
151 } else {
e3934b4c2950 Inline pidgin_prefs_dropdown_from_list_cb
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41371
diff changeset
152 g_return_if_reached();
22419
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
153 }
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
154 }
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
155
41384
4c6807a2260d Inline pidgin_prefs_dropdown_from_list_with_cb
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41383
diff changeset
156 GtkWidget *
4c6807a2260d Inline pidgin_prefs_dropdown_from_list_with_cb
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41383
diff changeset
157 pidgin_prefs_dropdown_from_list(GtkWidget *box, const gchar *title,
4c6807a2260d Inline pidgin_prefs_dropdown_from_list_with_cb
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41383
diff changeset
158 PurplePrefType type, const char *key, GList *menuitems)
22419
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
159 {
41384
4c6807a2260d Inline pidgin_prefs_dropdown_from_list_with_cb
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41383
diff changeset
160 GtkWidget *dropdown = NULL;
34121
797caf9ff740 pidgin_prefs_dropdown_from_list_with_cb implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34120
diff changeset
161 GtkWidget *label = NULL;
32904
f62f39d03dc7 Silence a warning.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32900
diff changeset
162 GtkListStore *store = NULL;
26934
988bd68379f8 Replace GtkOptionMenu with a GtkComboBox in the preferences dropdowns for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26628
diff changeset
163 GtkTreeIter active;
988bd68379f8 Replace GtkOptionMenu with a GtkComboBox in the preferences dropdowns for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26628
diff changeset
164 GtkCellRenderer *renderer;
41384
4c6807a2260d Inline pidgin_prefs_dropdown_from_list_with_cb
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41383
diff changeset
165 gint pref_int_value = 0;
4c6807a2260d Inline pidgin_prefs_dropdown_from_list_with_cb
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41383
diff changeset
166 const gchar *pref_str_value = NULL;
4c6807a2260d Inline pidgin_prefs_dropdown_from_list_with_cb
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41383
diff changeset
167 gboolean pref_bool_value = FALSE;
22419
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
168
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
169 g_return_val_if_fail(menuitems != NULL, NULL);
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
170
41384
4c6807a2260d Inline pidgin_prefs_dropdown_from_list_with_cb
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41383
diff changeset
171 if (type == PURPLE_PREF_INT) {
4c6807a2260d Inline pidgin_prefs_dropdown_from_list_with_cb
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41383
diff changeset
172 pref_int_value = purple_prefs_get_int(key);
41390
628971e4ecdf Expose PidginPrefCombo model enum in internal API
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41388
diff changeset
173 store = gtk_list_store_new(PIDGIN_PREF_COMBO_N_COLUMNS, G_TYPE_STRING,
628971e4ecdf Expose PidginPrefCombo model enum in internal API
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41388
diff changeset
174 G_TYPE_INT);
41384
4c6807a2260d Inline pidgin_prefs_dropdown_from_list_with_cb
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41383
diff changeset
175 } else if (type == PURPLE_PREF_STRING) {
4c6807a2260d Inline pidgin_prefs_dropdown_from_list_with_cb
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41383
diff changeset
176 pref_str_value = purple_prefs_get_string(key);
41390
628971e4ecdf Expose PidginPrefCombo model enum in internal API
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41388
diff changeset
177 store = gtk_list_store_new(PIDGIN_PREF_COMBO_N_COLUMNS, G_TYPE_STRING,
628971e4ecdf Expose PidginPrefCombo model enum in internal API
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41388
diff changeset
178 G_TYPE_STRING);
41384
4c6807a2260d Inline pidgin_prefs_dropdown_from_list_with_cb
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41383
diff changeset
179 } else if (type == PURPLE_PREF_BOOLEAN) {
4c6807a2260d Inline pidgin_prefs_dropdown_from_list_with_cb
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41383
diff changeset
180 pref_bool_value = purple_prefs_get_bool(key);
41390
628971e4ecdf Expose PidginPrefCombo model enum in internal API
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41388
diff changeset
181 store = gtk_list_store_new(PIDGIN_PREF_COMBO_N_COLUMNS, G_TYPE_STRING,
628971e4ecdf Expose PidginPrefCombo model enum in internal API
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41388
diff changeset
182 G_TYPE_BOOLEAN);
32904
f62f39d03dc7 Silence a warning.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32900
diff changeset
183 } else {
41384
4c6807a2260d Inline pidgin_prefs_dropdown_from_list_with_cb
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41383
diff changeset
184 g_return_val_if_reached(NULL);
22419
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
185 }
26934
988bd68379f8 Replace GtkOptionMenu with a GtkComboBox in the preferences dropdowns for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26628
diff changeset
186
988bd68379f8 Replace GtkOptionMenu with a GtkComboBox in the preferences dropdowns for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26628
diff changeset
187 dropdown = gtk_combo_box_new_with_model(GTK_TREE_MODEL(store));
41384
4c6807a2260d Inline pidgin_prefs_dropdown_from_list_with_cb
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41383
diff changeset
188 g_object_set_data(G_OBJECT(dropdown), "type", GINT_TO_POINTER(type));
26934
988bd68379f8 Replace GtkOptionMenu with a GtkComboBox in the preferences dropdowns for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26628
diff changeset
189
40326
cdca03a74387 Add PurpleNamedValue to use in lists instead of consecutive key and value elements
qarkai <qarkai@gmail.com>
parents: 40195
diff changeset
190 for (; menuitems != NULL; menuitems = g_list_next(menuitems)) {
40329
b5e0f65a5d9c Replace PurpleNamedValue with PurpleKeyValuePair
qarkai <qarkai@gmail.com>
parents: 40326
diff changeset
191 const PurpleKeyValuePair *menu_item = menuitems->data;
41387
146db40a9f24 Simplify active iter processing in PidginPrefCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41386
diff changeset
192 GtkTreeIter iter;
34121
797caf9ff740 pidgin_prefs_dropdown_from_list_with_cb implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34120
diff changeset
193
40329
b5e0f65a5d9c Replace PurpleNamedValue with PurpleKeyValuePair
qarkai <qarkai@gmail.com>
parents: 40326
diff changeset
194 if (menu_item->key == NULL) {
40326
cdca03a74387 Add PurpleNamedValue to use in lists instead of consecutive key and value elements
qarkai <qarkai@gmail.com>
parents: 40195
diff changeset
195 break;
cdca03a74387 Add PurpleNamedValue to use in lists instead of consecutive key and value elements
qarkai <qarkai@gmail.com>
parents: 40195
diff changeset
196 }
22419
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
197
26934
988bd68379f8 Replace GtkOptionMenu with a GtkComboBox in the preferences dropdowns for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26628
diff changeset
198 gtk_list_store_append(store, &iter);
988bd68379f8 Replace GtkOptionMenu with a GtkComboBox in the preferences dropdowns for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26628
diff changeset
199 gtk_list_store_set(store, &iter,
41390
628971e4ecdf Expose PidginPrefCombo model enum in internal API
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41388
diff changeset
200 PIDGIN_PREF_COMBO_TEXT, menu_item->key,
26934
988bd68379f8 Replace GtkOptionMenu with a GtkComboBox in the preferences dropdowns for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26628
diff changeset
201 -1);
22419
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
202
41384
4c6807a2260d Inline pidgin_prefs_dropdown_from_list_with_cb
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41383
diff changeset
203 if (type == PURPLE_PREF_INT) {
41387
146db40a9f24 Simplify active iter processing in PidginPrefCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41386
diff changeset
204 gint value = GPOINTER_TO_INT(menu_item->value);
41390
628971e4ecdf Expose PidginPrefCombo model enum in internal API
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41388
diff changeset
205 gtk_list_store_set(store, &iter, PIDGIN_PREF_COMBO_VALUE, value, -1);
41387
146db40a9f24 Simplify active iter processing in PidginPrefCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41386
diff changeset
206 if (pref_int_value == value) {
146db40a9f24 Simplify active iter processing in PidginPrefCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41386
diff changeset
207 active = iter;
146db40a9f24 Simplify active iter processing in PidginPrefCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41386
diff changeset
208 }
22419
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
209
41387
146db40a9f24 Simplify active iter processing in PidginPrefCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41386
diff changeset
210 } else if (type == PURPLE_PREF_STRING) {
146db40a9f24 Simplify active iter processing in PidginPrefCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41386
diff changeset
211 const gchar *value = (const gchar *)menu_item->value;
41390
628971e4ecdf Expose PidginPrefCombo model enum in internal API
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41388
diff changeset
212 gtk_list_store_set(store, &iter, PIDGIN_PREF_COMBO_VALUE, value, -1);
41387
146db40a9f24 Simplify active iter processing in PidginPrefCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41386
diff changeset
213 if (purple_strequal(pref_str_value, value)) {
146db40a9f24 Simplify active iter processing in PidginPrefCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41386
diff changeset
214 active = iter;
146db40a9f24 Simplify active iter processing in PidginPrefCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41386
diff changeset
215 }
146db40a9f24 Simplify active iter processing in PidginPrefCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41386
diff changeset
216
146db40a9f24 Simplify active iter processing in PidginPrefCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41386
diff changeset
217 } else if (type == PURPLE_PREF_BOOLEAN) {
146db40a9f24 Simplify active iter processing in PidginPrefCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41386
diff changeset
218 gboolean value = (gboolean)GPOINTER_TO_INT(menu_item->value);
41390
628971e4ecdf Expose PidginPrefCombo model enum in internal API
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41388
diff changeset
219 gtk_list_store_set(store, &iter, PIDGIN_PREF_COMBO_VALUE, value, -1);
41387
146db40a9f24 Simplify active iter processing in PidginPrefCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41386
diff changeset
220 if (pref_bool_value == value) {
146db40a9f24 Simplify active iter processing in PidginPrefCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41386
diff changeset
221 active = iter;
146db40a9f24 Simplify active iter processing in PidginPrefCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41386
diff changeset
222 }
22419
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
223 }
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
224 }
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
225
26934
988bd68379f8 Replace GtkOptionMenu with a GtkComboBox in the preferences dropdowns for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26628
diff changeset
226 renderer = gtk_cell_renderer_text_new();
988bd68379f8 Replace GtkOptionMenu with a GtkComboBox in the preferences dropdowns for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26628
diff changeset
227 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(dropdown), renderer, TRUE);
988bd68379f8 Replace GtkOptionMenu with a GtkComboBox in the preferences dropdowns for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26628
diff changeset
228 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(dropdown), renderer,
988bd68379f8 Replace GtkOptionMenu with a GtkComboBox in the preferences dropdowns for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26628
diff changeset
229 "text", 0,
988bd68379f8 Replace GtkOptionMenu with a GtkComboBox in the preferences dropdowns for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26628
diff changeset
230 NULL);
988bd68379f8 Replace GtkOptionMenu with a GtkComboBox in the preferences dropdowns for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26628
diff changeset
231
988bd68379f8 Replace GtkOptionMenu with a GtkComboBox in the preferences dropdowns for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26628
diff changeset
232 gtk_combo_box_set_active_iter(GTK_COMBO_BOX(dropdown), &active);
988bd68379f8 Replace GtkOptionMenu with a GtkComboBox in the preferences dropdowns for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26628
diff changeset
233
41380
e3934b4c2950 Inline pidgin_prefs_dropdown_from_list_cb
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41371
diff changeset
234 g_signal_connect(dropdown, "changed", G_CALLBACK(dropdown_set), NULL);
22419
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
235
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
236 pidgin_add_widget_to_vbox(GTK_BOX(box), title, NULL, dropdown, FALSE, &label);
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
237
34121
797caf9ff740 pidgin_prefs_dropdown_from_list_with_cb implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34120
diff changeset
238 g_object_set_data(G_OBJECT(dropdown), "key", (gpointer)key);
22419
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
239
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
240 return label;
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
241 }
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
242
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
243 GtkWidget *
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
244 pidgin_prefs_dropdown(GtkWidget *box, const gchar *title, PurplePrefType type,
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
245 const char *key, ...)
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
246 {
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
247 va_list ap;
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
248 GList *menuitems = NULL;
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
249 GtkWidget *dropdown = NULL;
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
250 char *name;
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
251
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
252 g_return_val_if_fail(type == PURPLE_PREF_BOOLEAN || type == PURPLE_PREF_INT ||
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
253 type == PURPLE_PREF_STRING, NULL);
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
254
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
255 va_start(ap, key);
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
256 while ((name = va_arg(ap, char *)) != NULL) {
40781
65dbbd384c8e Fix pidgin_prefs_dropdown
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40765
diff changeset
257 PurpleKeyValuePair *kvp;
22419
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
258
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
259 if (type == PURPLE_PREF_INT || type == PURPLE_PREF_BOOLEAN) {
40781
65dbbd384c8e Fix pidgin_prefs_dropdown
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40765
diff changeset
260 kvp = purple_key_value_pair_new(name, GINT_TO_POINTER(va_arg(ap, int)));
65dbbd384c8e Fix pidgin_prefs_dropdown
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40765
diff changeset
261 } else {
65dbbd384c8e Fix pidgin_prefs_dropdown
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40765
diff changeset
262 kvp = purple_key_value_pair_new(name, va_arg(ap, char *));
22419
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
263 }
40781
65dbbd384c8e Fix pidgin_prefs_dropdown
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40765
diff changeset
264 menuitems = g_list_prepend(menuitems, kvp);
22419
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
265 }
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
266 va_end(ap);
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
267
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
268 g_return_val_if_fail(menuitems != NULL, NULL);
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
269
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
270 menuitems = g_list_reverse(menuitems);
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
271
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
272 dropdown = pidgin_prefs_dropdown_from_list(box, title, type, key,
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
273 menuitems);
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
274
40781
65dbbd384c8e Fix pidgin_prefs_dropdown
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40765
diff changeset
275 g_list_free_full(menuitems, (GDestroyNotify)purple_key_value_pair_free);
22419
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
276
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
277 return dropdown;
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
278 }
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
279
39180
17bacc12c28f prefs: Move pidgin_prefs_checkbox earlier.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39179
diff changeset
280 static void
39181
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
281 bind_dropdown_set(GtkComboBox *combo_box, gpointer data)
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
282 {
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
283 PidginPrefCombo *combo = data;
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
284 GtkTreeIter iter;
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
285 GtkTreeModel *tree_model;
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
286
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
287 tree_model = gtk_combo_box_get_model(combo_box);
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
288 if (!gtk_combo_box_get_active_iter(combo_box, &iter))
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
289 return;
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
290
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
291 if (combo->type == PURPLE_PREF_INT) {
41383
686ea9361312 Drop pref value tracking on PidginPrefsCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41382
diff changeset
292 gint value;
41390
628971e4ecdf Expose PidginPrefCombo model enum in internal API
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41388
diff changeset
293 gtk_tree_model_get(tree_model, &iter, PIDGIN_PREF_COMBO_VALUE, &value, -1);
41383
686ea9361312 Drop pref value tracking on PidginPrefsCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41382
diff changeset
294 purple_prefs_set_int(combo->key, value);
41381
acedeb1e8804 Inline pidgin_prefs_bind_dropdown_from_list_cb
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41380
diff changeset
295 } else if (combo->type == PURPLE_PREF_STRING) {
41388
4df8fa04b777 Fix leak in PidginPrefCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41387
diff changeset
296 gchar *value;
41390
628971e4ecdf Expose PidginPrefCombo model enum in internal API
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41388
diff changeset
297 gtk_tree_model_get(tree_model, &iter, PIDGIN_PREF_COMBO_VALUE, &value, -1);
41383
686ea9361312 Drop pref value tracking on PidginPrefsCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41382
diff changeset
298 purple_prefs_set_string(combo->key, value);
41388
4df8fa04b777 Fix leak in PidginPrefCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41387
diff changeset
299 g_free(value);
41381
acedeb1e8804 Inline pidgin_prefs_bind_dropdown_from_list_cb
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41380
diff changeset
300 } else if (combo->type == PURPLE_PREF_BOOLEAN) {
41383
686ea9361312 Drop pref value tracking on PidginPrefsCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41382
diff changeset
301 gboolean value;
41390
628971e4ecdf Expose PidginPrefCombo model enum in internal API
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41388
diff changeset
302 gtk_tree_model_get(tree_model, &iter, PIDGIN_PREF_COMBO_VALUE, &value, -1);
41383
686ea9361312 Drop pref value tracking on PidginPrefsCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41382
diff changeset
303 purple_prefs_set_bool(combo->key, value);
41381
acedeb1e8804 Inline pidgin_prefs_bind_dropdown_from_list_cb
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41380
diff changeset
304 } else {
acedeb1e8804 Inline pidgin_prefs_bind_dropdown_from_list_cb
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41380
diff changeset
305 g_return_if_reached();
39181
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
306 }
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
307 }
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
308
41366
789f96848a43 Expose prefs binding functions internally
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41319
diff changeset
309 void
39181
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
310 pidgin_prefs_bind_dropdown(PidginPrefCombo *combo)
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
311 {
39754
0149cda729f7 Simplify some type casts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39752
diff changeset
312 GtkTreeModel *store = NULL;
39181
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
313 GtkTreeIter iter;
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
314 GtkTreeIter active;
41383
686ea9361312 Drop pref value tracking on PidginPrefsCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41382
diff changeset
315 int pref_int_value = 0;
686ea9361312 Drop pref value tracking on PidginPrefsCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41382
diff changeset
316 const char *pref_str_value = NULL;
686ea9361312 Drop pref value tracking on PidginPrefsCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41382
diff changeset
317 gboolean pref_bool_value = FALSE;
39181
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
318
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
319 if (combo->type == PURPLE_PREF_INT) {
41383
686ea9361312 Drop pref value tracking on PidginPrefsCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41382
diff changeset
320 pref_int_value = purple_prefs_get_int(combo->key);
39181
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
321 } else if (combo->type == PURPLE_PREF_STRING) {
41383
686ea9361312 Drop pref value tracking on PidginPrefsCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41382
diff changeset
322 pref_str_value = purple_prefs_get_string(combo->key);
39181
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
323 } else if (combo->type == PURPLE_PREF_BOOLEAN) {
41383
686ea9361312 Drop pref value tracking on PidginPrefsCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41382
diff changeset
324 pref_bool_value = purple_prefs_get_bool(combo->key);
39181
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
325 } else {
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
326 g_return_if_reached();
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
327 }
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
328
39754
0149cda729f7 Simplify some type casts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39752
diff changeset
329 store = gtk_combo_box_get_model(GTK_COMBO_BOX(combo->combo));
0149cda729f7 Simplify some type casts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39752
diff changeset
330
0149cda729f7 Simplify some type casts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39752
diff changeset
331 if (!gtk_tree_model_get_iter_first(store, &iter)) {
39181
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
332 g_return_if_reached();
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
333 }
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
334
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
335 do {
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
336 if (combo->type == PURPLE_PREF_INT) {
41387
146db40a9f24 Simplify active iter processing in PidginPrefCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41386
diff changeset
337 gint value = 0;
41390
628971e4ecdf Expose PidginPrefCombo model enum in internal API
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41388
diff changeset
338 gtk_tree_model_get(store, &iter, PIDGIN_PREF_COMBO_VALUE, &value, -1);
41387
146db40a9f24 Simplify active iter processing in PidginPrefCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41386
diff changeset
339 if (pref_int_value == value) {
39181
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
340 active = iter;
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
341 break;
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
342 }
41387
146db40a9f24 Simplify active iter processing in PidginPrefCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41386
diff changeset
343
146db40a9f24 Simplify active iter processing in PidginPrefCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41386
diff changeset
344 } else if (combo->type == PURPLE_PREF_STRING) {
41388
4df8fa04b777 Fix leak in PidginPrefCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41387
diff changeset
345 gchar *value = NULL;
41390
628971e4ecdf Expose PidginPrefCombo model enum in internal API
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41388
diff changeset
346 gtk_tree_model_get(store, &iter, PIDGIN_PREF_COMBO_VALUE, &value, -1);
41387
146db40a9f24 Simplify active iter processing in PidginPrefCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41386
diff changeset
347 if (purple_strequal(pref_str_value, value)) {
39181
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
348 active = iter;
41388
4df8fa04b777 Fix leak in PidginPrefCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41387
diff changeset
349 g_free(value);
39181
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
350 break;
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
351 }
41388
4df8fa04b777 Fix leak in PidginPrefCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41387
diff changeset
352 g_free(value);
41387
146db40a9f24 Simplify active iter processing in PidginPrefCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41386
diff changeset
353
146db40a9f24 Simplify active iter processing in PidginPrefCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41386
diff changeset
354 } else if (combo->type == PURPLE_PREF_BOOLEAN) {
146db40a9f24 Simplify active iter processing in PidginPrefCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41386
diff changeset
355 gboolean value = FALSE;
41390
628971e4ecdf Expose PidginPrefCombo model enum in internal API
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41388
diff changeset
356 gtk_tree_model_get(store, &iter, PIDGIN_PREF_COMBO_VALUE, &value, -1);
41387
146db40a9f24 Simplify active iter processing in PidginPrefCombo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41386
diff changeset
357 if (pref_bool_value == value) {
39181
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
358 active = iter;
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
359 break;
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
360 }
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
361 }
39754
0149cda729f7 Simplify some type casts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39752
diff changeset
362 } while (gtk_tree_model_iter_next(store, &iter));
39181
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
363
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
364 gtk_combo_box_set_active_iter(GTK_COMBO_BOX(combo->combo), &active);
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
365
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
366 g_signal_connect(G_OBJECT(combo->combo), "changed",
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
367 G_CALLBACK(bind_dropdown_set), combo);
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
368 }
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
369
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
370 static void
39180
17bacc12c28f prefs: Move pidgin_prefs_checkbox earlier.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39179
diff changeset
371 set_bool_pref(GtkWidget *w, const char *key)
17bacc12c28f prefs: Move pidgin_prefs_checkbox earlier.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39179
diff changeset
372 {
17bacc12c28f prefs: Move pidgin_prefs_checkbox earlier.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39179
diff changeset
373 purple_prefs_set_bool(key,
17bacc12c28f prefs: Move pidgin_prefs_checkbox earlier.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39179
diff changeset
374 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)));
17bacc12c28f prefs: Move pidgin_prefs_checkbox earlier.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39179
diff changeset
375 }
17bacc12c28f prefs: Move pidgin_prefs_checkbox earlier.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39179
diff changeset
376
17bacc12c28f prefs: Move pidgin_prefs_checkbox earlier.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39179
diff changeset
377 GtkWidget *
17bacc12c28f prefs: Move pidgin_prefs_checkbox earlier.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39179
diff changeset
378 pidgin_prefs_checkbox(const char *text, const char *key, GtkWidget *page)
17bacc12c28f prefs: Move pidgin_prefs_checkbox earlier.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39179
diff changeset
379 {
17bacc12c28f prefs: Move pidgin_prefs_checkbox earlier.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39179
diff changeset
380 GtkWidget *button;
17bacc12c28f prefs: Move pidgin_prefs_checkbox earlier.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39179
diff changeset
381
17bacc12c28f prefs: Move pidgin_prefs_checkbox earlier.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39179
diff changeset
382 button = gtk_check_button_new_with_mnemonic(text);
17bacc12c28f prefs: Move pidgin_prefs_checkbox earlier.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39179
diff changeset
383 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),
17bacc12c28f prefs: Move pidgin_prefs_checkbox earlier.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39179
diff changeset
384 purple_prefs_get_bool(key));
17bacc12c28f prefs: Move pidgin_prefs_checkbox earlier.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39179
diff changeset
385
17bacc12c28f prefs: Move pidgin_prefs_checkbox earlier.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39179
diff changeset
386 gtk_box_pack_start(GTK_BOX(page), button, FALSE, FALSE, 0);
17bacc12c28f prefs: Move pidgin_prefs_checkbox earlier.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39179
diff changeset
387
17bacc12c28f prefs: Move pidgin_prefs_checkbox earlier.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39179
diff changeset
388 g_signal_connect(G_OBJECT(button), "clicked",
17bacc12c28f prefs: Move pidgin_prefs_checkbox earlier.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39179
diff changeset
389 G_CALLBACK(set_bool_pref), (char *)key);
17bacc12c28f prefs: Move pidgin_prefs_checkbox earlier.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39179
diff changeset
390
17bacc12c28f prefs: Move pidgin_prefs_checkbox earlier.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39179
diff changeset
391 gtk_widget_show(button);
17bacc12c28f prefs: Move pidgin_prefs_checkbox earlier.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39179
diff changeset
392
17bacc12c28f prefs: Move pidgin_prefs_checkbox earlier.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39179
diff changeset
393 return button;
17bacc12c28f prefs: Move pidgin_prefs_checkbox earlier.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39179
diff changeset
394 }
17bacc12c28f prefs: Move pidgin_prefs_checkbox earlier.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39179
diff changeset
395
41366
789f96848a43 Expose prefs binding functions internally
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41319
diff changeset
396 void
39181
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
397 pidgin_prefs_bind_checkbox(const char *key, GtkWidget *button)
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
398 {
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
399 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
400 purple_prefs_get_bool(key));
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
401 g_signal_connect(G_OBJECT(button), "toggled",
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
402 G_CALLBACK(set_bool_pref), (char *)key);
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
403 }
f0cd633d86d4 prefs: Add binding versions of pref widget functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39180
diff changeset
404
22419
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
405 static void
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
406 delete_prefs(GtkWidget *asdf, void *gdsa)
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
407 {
40509
6748a5ec6644 remove the old sound api
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
408 /* Close any request dialogs */
22419
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
409 purple_request_close_with_handle(prefs);
34188
0680f2c10db3 Validation for internal keyring settings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34187
diff changeset
410 purple_notify_close_with_handle(prefs);
0680f2c10db3 Validation for internal keyring settings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34187
diff changeset
411
22419
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
412 /* Unregister callbacks. */
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
413 purple_prefs_disconnect_by_handle(prefs);
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
414
29150
6e6f7be71d50 Make sure all globals are NULL when the prefs page is destroyed.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29149
diff changeset
415 prefs = NULL;
22419
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
416 }
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
417
41385
d2f5ce624a49 Use GtkListStore for populating VV device prefs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41384
diff changeset
418 static void
39780
90027b926a3e Simplify signals for disabling VV pref tests.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39779
diff changeset
419 vv_test_switch_page_cb(GtkStack *stack, G_GNUC_UNUSED GParamSpec *pspec,
90027b926a3e Simplify signals for disabling VV pref tests.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39779
diff changeset
420 gpointer data)
33505
76208141a643 Disable VV tests when changing notebook tabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33504
diff changeset
421 {
41394
1327e58acce3 Split VV prefs into a separate widget
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41390
diff changeset
422 PidginVVPrefs *vv_prefs = data;
39780
90027b926a3e Simplify signals for disabling VV pref tests.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39779
diff changeset
423
90027b926a3e Simplify signals for disabling VV pref tests.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39779
diff changeset
424 if (!g_str_equal(gtk_stack_get_visible_child_name(stack), "vv")) {
90027b926a3e Simplify signals for disabling VV pref tests.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39779
diff changeset
425 /* Disable any running test pipelines. */
41394
1327e58acce3 Split VV prefs into a separate widget
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41390
diff changeset
426 pidgin_vv_prefs_disable_test_pipelines(vv_prefs);
33503
8959f9825768 Copy audio test from vvconfig into Preferences window.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33502
diff changeset
427 }
8959f9825768 Copy audio test from vvconfig into Preferences window.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33502
diff changeset
428 }
33502
f59489bd552b Copy VV device settings into a Preferences pane.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33357
diff changeset
429
41397
91e5ee47f5a1 Cleanup pidgin prefs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41394
diff changeset
430 /******************************************************************************
91e5ee47f5a1 Cleanup pidgin prefs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41394
diff changeset
431 * GObject Implementation
91e5ee47f5a1 Cleanup pidgin prefs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41394
diff changeset
432 *****************************************************************************/
27493
96dc1b8abdf9 You should check the indenting before a copy & paste...
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27451
diff changeset
433 static void
39178
53a96425ffc0 Start switching Preferences dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39177
diff changeset
434 pidgin_prefs_window_class_init(PidginPrefsWindowClass *klass)
22419
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
435 {
39178
53a96425ffc0 Start switching Preferences dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39177
diff changeset
436 GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
53a96425ffc0 Start switching Preferences dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39177
diff changeset
437
53a96425ffc0 Start switching Preferences dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39177
diff changeset
438 gtk_widget_class_set_template_from_resource(
53a96425ffc0 Start switching Preferences dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39177
diff changeset
439 widget_class,
41030
ec8b76f3bf0a Fix the resource path so we can use the automatic stuff that GtkApplication supports
Gary Kramlich <grim@reaperworld.com>
parents: 40886
diff changeset
440 "/im/pidgin/Pidgin3/Prefs/prefs.ui"
39178
53a96425ffc0 Start switching Preferences dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39177
diff changeset
441 );
53a96425ffc0 Start switching Preferences dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39177
diff changeset
442
39182
a7a028be4bcd prefs: Convert Logging page to glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39181
diff changeset
443 /* Main window */
39178
53a96425ffc0 Start switching Preferences dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39177
diff changeset
444 gtk_widget_class_bind_template_callback(widget_class, delete_prefs);
41490
2b1695327414 Make VV libraries required
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41397
diff changeset
445 gtk_widget_class_bind_template_callback(widget_class,
2b1695327414 Make VV libraries required
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41397
diff changeset
446 vv_test_switch_page_cb);
39178
53a96425ffc0 Start switching Preferences dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39177
diff changeset
447 }
53a96425ffc0 Start switching Preferences dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39177
diff changeset
448
53a96425ffc0 Start switching Preferences dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39177
diff changeset
449 static void
53a96425ffc0 Start switching Preferences dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39177
diff changeset
450 pidgin_prefs_window_init(PidginPrefsWindow *win)
53a96425ffc0 Start switching Preferences dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39177
diff changeset
451 {
53a96425ffc0 Start switching Preferences dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39177
diff changeset
452 gtk_widget_init_template(GTK_WIDGET(win));
53a96425ffc0 Start switching Preferences dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39177
diff changeset
453 }
53a96425ffc0 Start switching Preferences dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39177
diff changeset
454
41397
91e5ee47f5a1 Cleanup pidgin prefs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41394
diff changeset
455 /******************************************************************************
91e5ee47f5a1 Cleanup pidgin prefs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41394
diff changeset
456 * API
91e5ee47f5a1 Cleanup pidgin prefs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41394
diff changeset
457 *****************************************************************************/
39178
53a96425ffc0 Start switching Preferences dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39177
diff changeset
458 void
53a96425ffc0 Start switching Preferences dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39177
diff changeset
459 pidgin_prefs_show(void)
53a96425ffc0 Start switching Preferences dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39177
diff changeset
460 {
53a96425ffc0 Start switching Preferences dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39177
diff changeset
461 if (prefs == NULL) {
53a96425ffc0 Start switching Preferences dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39177
diff changeset
462 prefs = PIDGIN_PREFS_WINDOW(g_object_new(
53a96425ffc0 Start switching Preferences dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39177
diff changeset
463 pidgin_prefs_window_get_type(), NULL));
53a96425ffc0 Start switching Preferences dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39177
diff changeset
464 }
53a96425ffc0 Start switching Preferences dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39177
diff changeset
465
53a96425ffc0 Start switching Preferences dialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39177
diff changeset
466 gtk_window_present(GTK_WINDOW(prefs));
22419
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
467 }
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
468
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
469 void
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
470 pidgin_prefs_init(void)
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
471 {
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
472 purple_prefs_add_none(PIDGIN_PREFS_ROOT "");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
473 purple_prefs_add_none("/plugins/gtk");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
474
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
475 /* Plugins */
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
476 purple_prefs_add_none(PIDGIN_PREFS_ROOT "/plugins");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
477 purple_prefs_add_path_list(PIDGIN_PREFS_ROOT "/plugins/loaded", NULL);
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
478
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
479 /* File locations */
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
480 purple_prefs_add_none(PIDGIN_PREFS_ROOT "/filelocations");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
481 purple_prefs_add_path(PIDGIN_PREFS_ROOT "/filelocations/last_save_folder", "");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
482 purple_prefs_add_path(PIDGIN_PREFS_ROOT "/filelocations/last_open_folder", "");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
483 purple_prefs_add_path(PIDGIN_PREFS_ROOT "/filelocations/last_icon_folder", "");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
484
33508
188563e24535 Migrate and correctly create VV prefs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33507
diff changeset
485 /* Voice/Video */
188563e24535 Migrate and correctly create VV prefs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33507
diff changeset
486 purple_prefs_add_none(PIDGIN_PREFS_ROOT "/vvconfig");
188563e24535 Migrate and correctly create VV prefs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33507
diff changeset
487 purple_prefs_add_none(PIDGIN_PREFS_ROOT "/vvconfig/audio");
188563e24535 Migrate and correctly create VV prefs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33507
diff changeset
488 purple_prefs_add_none(PIDGIN_PREFS_ROOT "/vvconfig/audio/src");
188563e24535 Migrate and correctly create VV prefs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33507
diff changeset
489 purple_prefs_add_string(PIDGIN_PREFS_ROOT "/vvconfig/audio/src/device", "");
188563e24535 Migrate and correctly create VV prefs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33507
diff changeset
490 purple_prefs_add_none(PIDGIN_PREFS_ROOT "/vvconfig/audio/sink");
188563e24535 Migrate and correctly create VV prefs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33507
diff changeset
491 purple_prefs_add_string(PIDGIN_PREFS_ROOT "/vvconfig/audio/sink/device", "");
188563e24535 Migrate and correctly create VV prefs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33507
diff changeset
492 purple_prefs_add_none(PIDGIN_PREFS_ROOT "/vvconfig/video");
188563e24535 Migrate and correctly create VV prefs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33507
diff changeset
493 purple_prefs_add_none(PIDGIN_PREFS_ROOT "/vvconfig/video/src");
188563e24535 Migrate and correctly create VV prefs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33507
diff changeset
494 purple_prefs_add_string(PIDGIN_PREFS_ROOT "/vvconfig/video/src/device", "");
188563e24535 Migrate and correctly create VV prefs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33507
diff changeset
495 purple_prefs_add_none(PIDGIN_PREFS_ROOT "/vvconfig/video");
188563e24535 Migrate and correctly create VV prefs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33507
diff changeset
496 purple_prefs_add_none(PIDGIN_PREFS_ROOT "/vvconfig/video/sink");
188563e24535 Migrate and correctly create VV prefs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33507
diff changeset
497 purple_prefs_add_string(PIDGIN_PREFS_ROOT "/vvconfig/video/sink/device", "");
188563e24535 Migrate and correctly create VV prefs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33507
diff changeset
498
22419
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
499 pidgin_prefs_update_old();
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
500 }
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
501
27493
96dc1b8abdf9 You should check the indenting before a copy & paste...
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27451
diff changeset
502 void
96dc1b8abdf9 You should check the indenting before a copy & paste...
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27451
diff changeset
503 pidgin_prefs_update_old(void)
22419
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
504 {
40547
86e0c5080a58 vv: Switch to GTK sinks by default.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40542
diff changeset
505 const gchar *video_sink = NULL;
86e0c5080a58 vv: Switch to GTK sinks by default.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40542
diff changeset
506
22419
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
507 /* Rename some old prefs */
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
508 purple_prefs_rename(PIDGIN_PREFS_ROOT "/conversations/im/raise_on_events", "/plugins/gtk/X11/notify/method_raise");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
509
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
510 purple_prefs_rename_boolean_toggle(PIDGIN_PREFS_ROOT "/conversations/ignore_colors",
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
511 PIDGIN_PREFS_ROOT "/conversations/show_incoming_formatting");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
512
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
513 /* Remove some no-longer-used prefs */
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
514 purple_prefs_remove(PIDGIN_PREFS_ROOT "/blist/auto_expand_contacts");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
515 purple_prefs_remove(PIDGIN_PREFS_ROOT "/blist/button_style");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
516 purple_prefs_remove(PIDGIN_PREFS_ROOT "/blist/grey_idle_buddies");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
517 purple_prefs_remove(PIDGIN_PREFS_ROOT "/blist/raise_on_events");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
518 purple_prefs_remove(PIDGIN_PREFS_ROOT "/blist/show_group_count");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
519 purple_prefs_remove(PIDGIN_PREFS_ROOT "/blist/show_warning_level");
34259
5309bb9956cf Remove the tooltip_delay pref from prefs.xml.
Mark Doliner <mark@kingant.net>
parents: 34241
diff changeset
520 purple_prefs_remove(PIDGIN_PREFS_ROOT "/blist/tooltip_delay");
39317
b31b810fe6db gtkblist: Remove blist position storage
Mike Ruprecht <cmaiku@gmail.com>
parents: 39281
diff changeset
521 purple_prefs_remove(PIDGIN_PREFS_ROOT "/blist/x");
b31b810fe6db gtkblist: Remove blist position storage
Mike Ruprecht <cmaiku@gmail.com>
parents: 39281
diff changeset
522 purple_prefs_remove(PIDGIN_PREFS_ROOT "/blist/y");
40501
011cdaa64ecc Replace the manual browser opening code with gtk_show_uri_on_window
Gary Kramlich <grim@reaperworld.com>
parents: 40496
diff changeset
523 purple_prefs_remove(PIDGIN_PREFS_ROOT "/browsers");
011cdaa64ecc Replace the manual browser opening code with gtk_show_uri_on_window
Gary Kramlich <grim@reaperworld.com>
parents: 40496
diff changeset
524 purple_prefs_remove(PIDGIN_PREFS_ROOT "/browsers/browser");
011cdaa64ecc Replace the manual browser opening code with gtk_show_uri_on_window
Gary Kramlich <grim@reaperworld.com>
parents: 40496
diff changeset
525 purple_prefs_remove(PIDGIN_PREFS_ROOT "/browsers/command");
011cdaa64ecc Replace the manual browser opening code with gtk_show_uri_on_window
Gary Kramlich <grim@reaperworld.com>
parents: 40496
diff changeset
526 purple_prefs_remove(PIDGIN_PREFS_ROOT "/browsers/place");
011cdaa64ecc Replace the manual browser opening code with gtk_show_uri_on_window
Gary Kramlich <grim@reaperworld.com>
parents: 40496
diff changeset
527 purple_prefs_remove(PIDGIN_PREFS_ROOT "/browsers/manual_command");
22419
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
528 purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/button_type");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
529 purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/ctrl_enter_sends");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
530 purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/enter_sends");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
531 purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/escape_closes");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
532 purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/html_shortcuts");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
533 purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/icons_on_tabs");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
534 purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/send_formatting");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
535 purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/show_urls_as_links");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
536 purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/use_custom_bgcolor");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
537 purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/use_custom_fgcolor");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
538 purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/use_custom_font");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
539 purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/use_custom_size");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
540 purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/chat/old_tab_complete");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
541 purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/chat/tab_completion");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
542 purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/im/hide_on_send");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
543 purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/chat/color_nicks");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
544 purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/chat/raise_on_events");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
545 purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/ignore_fonts");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
546 purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/ignore_font_sizes");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
547 purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/passthrough_unknown_commands");
32732
3166ba6f2096 We haven't used this pref in a while. We stopped adding it in
Mark Doliner <markdoliner@pidgin.im>
parents: 32596
diff changeset
548 purple_prefs_remove(PIDGIN_PREFS_ROOT "/debug/timestamps");
22419
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
549 purple_prefs_remove(PIDGIN_PREFS_ROOT "/idle");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
550 purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/signon");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
551 purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/silent_signon");
40509
6748a5ec6644 remove the old sound api
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
552 purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/command");
6748a5ec6644 remove the old sound api
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
553 purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/conv_focus");
6748a5ec6644 remove the old sound api
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
554 purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/enabled/chat_msg_recv");
6748a5ec6644 remove the old sound api
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
555 purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/enabled/first_im_recv");
6748a5ec6644 remove the old sound api
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
556 purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/enabled/got_attention");
6748a5ec6644 remove the old sound api
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
557 purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/enabled/im_recv");
6748a5ec6644 remove the old sound api
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
558 purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/enabled/join_chat");
6748a5ec6644 remove the old sound api
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
559 purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/enabled/left_chat");
6748a5ec6644 remove the old sound api
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
560 purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/enabled/login");
6748a5ec6644 remove the old sound api
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
561 purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/enabled/logout");
6748a5ec6644 remove the old sound api
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
562 purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/enabled/nick_said");
6748a5ec6644 remove the old sound api
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
563 purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/enabled/pounce_default");
6748a5ec6644 remove the old sound api
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
564 purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/enabled/send_chat_msg");
6748a5ec6644 remove the old sound api
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
565 purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/enabled/send_im");
6748a5ec6644 remove the old sound api
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
566 purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/enabled/sent_attention");
6748a5ec6644 remove the old sound api
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
567 purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/enabled");
6748a5ec6644 remove the old sound api
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
568 purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/file/chat_msg_recv");
6748a5ec6644 remove the old sound api
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
569 purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/file/first_im_recv");
6748a5ec6644 remove the old sound api
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
570 purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/file/got_attention");
6748a5ec6644 remove the old sound api
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
571 purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/file/im_recv");
6748a5ec6644 remove the old sound api
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
572 purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/file/join_chat");
6748a5ec6644 remove the old sound api
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
573 purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/file/left_chat");
6748a5ec6644 remove the old sound api
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
574 purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/file/login");
6748a5ec6644 remove the old sound api
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
575 purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/file/logout");
6748a5ec6644 remove the old sound api
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
576 purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/file/nick_said");
6748a5ec6644 remove the old sound api
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
577 purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/file/pounce_default");
6748a5ec6644 remove the old sound api
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
578 purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/file/send_chat_msg");
6748a5ec6644 remove the old sound api
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
579 purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/file/send_im");
6748a5ec6644 remove the old sound api
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
580 purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/file/sent_attention");
6748a5ec6644 remove the old sound api
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
581 purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/file");
6748a5ec6644 remove the old sound api
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
582 purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/method");
6748a5ec6644 remove the old sound api
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
583 purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/mute");
6748a5ec6644 remove the old sound api
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
584 purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/theme");
6748a5ec6644 remove the old sound api
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
585 purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound");
22419
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
586
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
587 purple_prefs_remove(PIDGIN_PREFS_ROOT "/away/queue_messages");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
588 purple_prefs_remove(PIDGIN_PREFS_ROOT "/away");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
589 purple_prefs_remove("/plugins/gtk/docklet/queue_messages");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
590
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
591 purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/chat/default_width");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
592 purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/chat/default_height");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
593 purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/im/default_width");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
594 purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/im/default_height");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
595 purple_prefs_rename(PIDGIN_PREFS_ROOT "/conversations/x",
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
596 PIDGIN_PREFS_ROOT "/conversations/im/x");
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
597 purple_prefs_rename(PIDGIN_PREFS_ROOT "/conversations/y",
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
598 PIDGIN_PREFS_ROOT "/conversations/im/y");
33508
188563e24535 Migrate and correctly create VV prefs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33507
diff changeset
599
188563e24535 Migrate and correctly create VV prefs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33507
diff changeset
600 /* Fixup vvconfig plugin prefs */
188563e24535 Migrate and correctly create VV prefs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33507
diff changeset
601 if (purple_prefs_exists("/plugins/core/vvconfig/audio/src/device")) {
188563e24535 Migrate and correctly create VV prefs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33507
diff changeset
602 purple_prefs_set_string(PIDGIN_PREFS_ROOT "/vvconfig/audio/src/device",
188563e24535 Migrate and correctly create VV prefs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33507
diff changeset
603 purple_prefs_get_string("/plugins/core/vvconfig/audio/src/device"));
188563e24535 Migrate and correctly create VV prefs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33507
diff changeset
604 }
188563e24535 Migrate and correctly create VV prefs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33507
diff changeset
605 if (purple_prefs_exists("/plugins/core/vvconfig/audio/sink/device")) {
188563e24535 Migrate and correctly create VV prefs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33507
diff changeset
606 purple_prefs_set_string(PIDGIN_PREFS_ROOT "/vvconfig/audio/sink/device",
188563e24535 Migrate and correctly create VV prefs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33507
diff changeset
607 purple_prefs_get_string("/plugins/core/vvconfig/audio/sink/device"));
188563e24535 Migrate and correctly create VV prefs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33507
diff changeset
608 }
188563e24535 Migrate and correctly create VV prefs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33507
diff changeset
609 if (purple_prefs_exists("/plugins/core/vvconfig/video/src/device")) {
188563e24535 Migrate and correctly create VV prefs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33507
diff changeset
610 purple_prefs_set_string(PIDGIN_PREFS_ROOT "/vvconfig/video/src/device",
188563e24535 Migrate and correctly create VV prefs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33507
diff changeset
611 purple_prefs_get_string("/plugins/core/vvconfig/video/src/device"));
188563e24535 Migrate and correctly create VV prefs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33507
diff changeset
612 }
188563e24535 Migrate and correctly create VV prefs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33507
diff changeset
613 if (purple_prefs_exists("/plugins/gtk/vvconfig/video/sink/device")) {
188563e24535 Migrate and correctly create VV prefs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33507
diff changeset
614 purple_prefs_set_string(PIDGIN_PREFS_ROOT "/vvconfig/video/sink/device",
188563e24535 Migrate and correctly create VV prefs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33507
diff changeset
615 purple_prefs_get_string("/plugins/gtk/vvconfig/video/sink/device"));
188563e24535 Migrate and correctly create VV prefs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33507
diff changeset
616 }
188563e24535 Migrate and correctly create VV prefs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33507
diff changeset
617
40547
86e0c5080a58 vv: Switch to GTK sinks by default.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40542
diff changeset
618 video_sink = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/vvconfig/video/sink/device");
86e0c5080a58 vv: Switch to GTK sinks by default.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40542
diff changeset
619 if (purple_strequal(video_sink, "glimagesink") || purple_strequal(video_sink, "directdrawsink")) {
86e0c5080a58 vv: Switch to GTK sinks by default.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40542
diff changeset
620 /* Accelerated sinks move to GTK GL. */
40647
33d7e6abb37f Fix a few random issues that scanbuild found.
Gary Kramlich <grim@reaperworld.com>
parents: 40552
diff changeset
621 /* video_sink = "gtkglsink"; */
40547
86e0c5080a58 vv: Switch to GTK sinks by default.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40542
diff changeset
622 /* FIXME: I haven't been able to get gtkglsink to work yet: */
86e0c5080a58 vv: Switch to GTK sinks by default.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40542
diff changeset
623 video_sink = "gtksink";
86e0c5080a58 vv: Switch to GTK sinks by default.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40542
diff changeset
624 } else {
86e0c5080a58 vv: Switch to GTK sinks by default.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40542
diff changeset
625 /* Everything else, including default will be moved to GTK sink. */
86e0c5080a58 vv: Switch to GTK sinks by default.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40542
diff changeset
626 video_sink = "gtksink";
86e0c5080a58 vv: Switch to GTK sinks by default.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40542
diff changeset
627 }
86e0c5080a58 vv: Switch to GTK sinks by default.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40542
diff changeset
628 purple_prefs_set_string(PIDGIN_PREFS_ROOT "/vvconfig/video/sink/device", video_sink);
86e0c5080a58 vv: Switch to GTK sinks by default.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40542
diff changeset
629
33508
188563e24535 Migrate and correctly create VV prefs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33507
diff changeset
630 purple_prefs_remove("/plugins/core/vvconfig");
188563e24535 Migrate and correctly create VV prefs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33507
diff changeset
631 purple_prefs_remove("/plugins/gtk/vvconfig");
35105
ed127ccd9b9f Remove the "existing window" option for where to open URLs.
Mark Doliner <mark@kingant.net>
parents: 34955
diff changeset
632
37886
d4ed67195cbf gtkprefs: rework Voice/Video preferences page
Jakub Adam <jakub.adam@ktknet.cz>
parents: 37677
diff changeset
633 purple_prefs_remove(PIDGIN_PREFS_ROOT "/vvconfig/audio/src/plugin");
d4ed67195cbf gtkprefs: rework Voice/Video preferences page
Jakub Adam <jakub.adam@ktknet.cz>
parents: 37677
diff changeset
634 purple_prefs_remove(PIDGIN_PREFS_ROOT "/vvconfig/audio/sink/plugin");
d4ed67195cbf gtkprefs: rework Voice/Video preferences page
Jakub Adam <jakub.adam@ktknet.cz>
parents: 37677
diff changeset
635 purple_prefs_remove(PIDGIN_PREFS_ROOT "/vvconfig/video/src/plugin");
d4ed67195cbf gtkprefs: rework Voice/Video preferences page
Jakub Adam <jakub.adam@ktknet.cz>
parents: 37677
diff changeset
636 purple_prefs_remove(PIDGIN_PREFS_ROOT "/vvconfig/video/sink/plugin");
22419
e7d643f4de4b Bring back the "Close IMs immediately when the tab is closed" pref. As far
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22412
diff changeset
637 }
33508
188563e24535 Migrate and correctly create VV prefs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33507
diff changeset
638

mercurial