Rename PidginNetworkPage to PidginNetworkPrefs

Sun, 15 May 2022 02:33:17 -0500

author
Elliott Sales de Andrade <quantum.analyst@gmail.com>
date
Sun, 15 May 2022 02:33:17 -0500
changeset 41376
5bd22f39246a
parent 41375
e7f3a586b63f
child 41377
89e348e53f71

Rename PidginNetworkPage to PidginNetworkPrefs

pidgin/meson.build file | annotate | diff | comparison | revisions
pidgin/prefs/pidginnetworkpage.c file | annotate | diff | comparison | revisions
pidgin/prefs/pidginnetworkpage.h file | annotate | diff | comparison | revisions
pidgin/prefs/pidginnetworkprefs.c file | annotate | diff | comparison | revisions
pidgin/prefs/pidginnetworkprefs.h file | annotate | diff | comparison | revisions
pidgin/resources/Prefs/network.ui file | annotate | diff | comparison | revisions
pidgin/resources/Prefs/prefs.ui file | annotate | diff | comparison | revisions
--- a/pidgin/meson.build	Sun May 15 02:33:17 2022 -0500
+++ b/pidgin/meson.build	Sun May 15 02:33:17 2022 -0500
@@ -64,7 +64,7 @@
 	'prefs/pidginconversationprefs.c',
 	'prefs/pidgincredentialproviderrow.c',
 	'prefs/pidgincredentialprefs.c',
-	'prefs/pidginnetworkpage.c',
+	'prefs/pidginnetworkprefs.c',
 	'prefs/pidginproxyprefs.c',
 ]
 
@@ -136,7 +136,7 @@
 	'prefs/pidginconversationprefs.h',
 	'prefs/pidgincredentialproviderrow.h',
 	'prefs/pidgincredentialprefs.h',
-	'prefs/pidginnetworkpage.h',
+	'prefs/pidginnetworkprefs.h',
 	'prefs/pidginproxyprefs.h',
 ]
 
--- a/pidgin/prefs/pidginnetworkpage.c	Sun May 15 02:33:17 2022 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,262 +0,0 @@
-/*
- * Pidgin - Internet Messenger
- * Copyright (C) Pidgin Developers <devel@pidgin.im>
- *
- * Pidgin is the legal property of its developers, whose names are too numerous
- * to list here.  Please refer to the COPYRIGHT file distributed with this
- * source distribution.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <https://www.gnu.org/licenses/>.
- */
-
-#include <glib/gi18n-lib.h>
-
-#include <purple.h>
-
-#include <handy.h>
-#include <nice.h>
-
-#include "pidginnetworkpage.h"
-#include "pidginprefsinternal.h"
-
-struct _PidginNetworkPage {
-	HdyPreferencesPage parent;
-
-	GtkWidget *stun_server;
-	GtkWidget *auto_ip;
-	GtkWidget *public_ip;
-	GtkWidget *public_ip_hbox;
-	GtkWidget *map_ports;
-	GtkWidget *ports_range_use;
-	GtkWidget *ports_range_hbox;
-	GtkWidget *ports_range_start;
-	GtkWidget *ports_range_end;
-	GtkWidget *turn_server;
-	GtkWidget *turn_port_udp;
-	GtkWidget *turn_port_tcp;
-	GtkWidget *turn_username;
-	GtkWidget *turn_password;
-};
-
-G_DEFINE_TYPE(PidginNetworkPage, pidgin_network_page, HDY_TYPE_PREFERENCES_PAGE)
-
-/******************************************************************************
- * Helpers
- *****************************************************************************/
-static void
-network_ip_changed(GtkEntry *entry, gpointer data)
-{
-	const gchar *text = gtk_entry_get_text(entry);
-	GtkStyleContext *context = gtk_widget_get_style_context(GTK_WIDGET(entry));
-
-	if (text && *text) {
-		if (g_hostname_is_ip_address(text)) {
-			purple_network_set_public_ip(text);
-			gtk_style_context_add_class(context, "good-ip");
-			gtk_style_context_remove_class(context, "bad-ip");
-		} else {
-			gtk_style_context_add_class(context, "bad-ip");
-			gtk_style_context_remove_class(context, "good-ip");
-		}
-
-	} else {
-		purple_network_set_public_ip("");
-		gtk_style_context_remove_class(context, "bad-ip");
-		gtk_style_context_remove_class(context, "good-ip");
-	}
-}
-
-static gboolean
-network_stun_server_changed_cb(GtkWidget *widget,
-                               GdkEventFocus *event, gpointer data)
-{
-	GtkEntry *entry = GTK_ENTRY(widget);
-	purple_prefs_set_string("/purple/network/stun_server",
-		gtk_entry_get_text(entry));
-	purple_network_set_stun_server(gtk_entry_get_text(entry));
-
-	return FALSE;
-}
-
-static gboolean
-network_turn_server_changed_cb(GtkWidget *widget,
-                               GdkEventFocus *event, gpointer data)
-{
-	GtkEntry *entry = GTK_ENTRY(widget);
-	purple_prefs_set_string("/purple/network/turn_server",
-		gtk_entry_get_text(entry));
-	purple_network_set_turn_server(gtk_entry_get_text(entry));
-
-	return FALSE;
-}
-
-static void
-auto_ip_button_clicked_cb(GtkWidget *button, gpointer null)
-{
-	const char *ip;
-	PurpleStunNatDiscovery *stun;
-	char *auto_ip_text;
-	GList *list = NULL;
-
-	/* Make a lookup for the auto-detected IP ourselves. */
-	if (purple_prefs_get_bool("/purple/network/auto_ip")) {
-		/* Check if STUN discovery was already done */
-		stun = purple_stun_discover(NULL);
-		if ((stun != NULL) && (stun->status == PURPLE_STUN_STATUS_DISCOVERED)) {
-			ip = stun->publicip;
-		} else {
-			/* Attempt to get the IP from a NAT device using UPnP */
-			ip = purple_upnp_get_public_ip();
-			if (ip == NULL) {
-				/* Attempt to get the IP from a NAT device using NAT-PMP */
-				ip = purple_pmp_get_public_ip();
-				if (ip == NULL) {
-					/* Just fetch the first IP of the local system */
-					list = nice_interfaces_get_local_ips(FALSE);
-					if (list) {
-						ip = list->data;
-					} else {
-						ip = "0.0.0.0";
-					}
-				}
-			}
-		}
-	} else {
-		ip = _("Disabled");
-	}
-
-	auto_ip_text = g_strdup_printf(_("Use _automatically detected IP address: %s"), ip);
-	gtk_button_set_label(GTK_BUTTON(button), auto_ip_text);
-	g_free(auto_ip_text);
-	g_list_free_full(list, g_free);
-}
-
-/******************************************************************************
- * GObject Implementation
- *****************************************************************************/
-static void
-pidgin_network_page_class_init(PidginNetworkPageClass *klass)
-{
-	GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
-
-	gtk_widget_class_set_template_from_resource(
-		widget_class,
-		"/im/pidgin/Pidgin3/Prefs/network.ui"
-	);
-
-	gtk_widget_class_bind_template_child(
-			widget_class, PidginNetworkPage, stun_server);
-	gtk_widget_class_bind_template_child(
-			widget_class, PidginNetworkPage, auto_ip);
-	gtk_widget_class_bind_template_child(
-			widget_class, PidginNetworkPage, public_ip);
-	gtk_widget_class_bind_template_child(
-			widget_class, PidginNetworkPage, public_ip_hbox);
-	gtk_widget_class_bind_template_child(
-			widget_class, PidginNetworkPage, map_ports);
-	gtk_widget_class_bind_template_child(
-			widget_class, PidginNetworkPage, ports_range_use);
-	gtk_widget_class_bind_template_child(
-			widget_class, PidginNetworkPage, ports_range_hbox);
-	gtk_widget_class_bind_template_child(
-			widget_class, PidginNetworkPage, ports_range_start);
-	gtk_widget_class_bind_template_child(
-			widget_class, PidginNetworkPage, ports_range_end);
-	gtk_widget_class_bind_template_child(
-			widget_class, PidginNetworkPage, turn_server);
-	gtk_widget_class_bind_template_child(
-			widget_class, PidginNetworkPage, turn_port_udp);
-	gtk_widget_class_bind_template_child(
-			widget_class, PidginNetworkPage, turn_port_tcp);
-	gtk_widget_class_bind_template_child(
-			widget_class, PidginNetworkPage, turn_username);
-	gtk_widget_class_bind_template_child(
-			widget_class, PidginNetworkPage, turn_password);
-	gtk_widget_class_bind_template_callback(widget_class,
-			network_stun_server_changed_cb);
-	gtk_widget_class_bind_template_callback(widget_class,
-	                 auto_ip_button_clicked_cb);
-	gtk_widget_class_bind_template_callback(widget_class,
-			network_ip_changed);
-	gtk_widget_class_bind_template_callback(widget_class,
-			network_turn_server_changed_cb);
-}
-
-static void
-pidgin_network_page_init(PidginNetworkPage *page)
-{
-	GtkStyleContext *context;
-	GtkCssProvider *ip_css;
-
-	gtk_widget_init_template(GTK_WIDGET(page));
-
-	gtk_entry_set_text(GTK_ENTRY(page->stun_server),
-			purple_prefs_get_string("/purple/network/stun_server"));
-
-	pidgin_prefs_bind_checkbox("/purple/network/auto_ip", page->auto_ip);
-	auto_ip_button_clicked_cb(page->auto_ip, NULL); /* Update label */
-
-	gtk_entry_set_text(GTK_ENTRY(page->public_ip),
-			purple_network_get_public_ip());
-
-	ip_css = gtk_css_provider_new();
-	gtk_css_provider_load_from_resource(ip_css,
-	                                    "/im/pidgin/Pidgin3/Prefs/ip.css");
-
-	context = gtk_widget_get_style_context(page->public_ip);
-	gtk_style_context_add_provider(context,
-	                               GTK_STYLE_PROVIDER(ip_css),
-	                               GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
-
-	g_object_bind_property(page->auto_ip, "active",
-			page->public_ip_hbox, "sensitive",
-			G_BINDING_SYNC_CREATE|G_BINDING_INVERT_BOOLEAN);
-
-	pidgin_prefs_bind_checkbox("/purple/network/map_ports",
-			page->map_ports);
-
-	pidgin_prefs_bind_checkbox("/purple/network/ports_range_use",
-			page->ports_range_use);
-	g_object_bind_property(page->ports_range_use, "active",
-			page->ports_range_hbox, "sensitive",
-			G_BINDING_SYNC_CREATE);
-
-	pidgin_prefs_bind_spin_button("/purple/network/ports_range_start",
-			page->ports_range_start);
-	pidgin_prefs_bind_spin_button("/purple/network/ports_range_end",
-			page->ports_range_end);
-
-	/* TURN server */
-	gtk_entry_set_text(GTK_ENTRY(page->turn_server),
-			purple_prefs_get_string("/purple/network/turn_server"));
-
-	pidgin_prefs_bind_spin_button("/purple/network/turn_port",
-			page->turn_port_udp);
-
-	pidgin_prefs_bind_spin_button("/purple/network/turn_port_tcp",
-			page->turn_port_tcp);
-
-	pidgin_prefs_bind_entry("/purple/network/turn_username",
-			page->turn_username);
-	pidgin_prefs_bind_entry("/purple/network/turn_password",
-			page->turn_password);
-}
-
-/******************************************************************************
- * API
- *****************************************************************************/
-GtkWidget *
-pidgin_network_page_new(void) {
-	return GTK_WIDGET(g_object_new(PIDGIN_TYPE_NETWORK_PAGE, NULL));
-}
--- a/pidgin/prefs/pidginnetworkpage.h	Sun May 15 02:33:17 2022 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
- * Pidgin - Internet Messenger
- * Copyright (C) Pidgin Developers <devel@pidgin.im>
- *
- * Pidgin is the legal property of its developers, whose names are too numerous
- * to list here.  Please refer to the COPYRIGHT file distributed with this
- * source distribution.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <https://www.gnu.org/licenses/>.
- */
-
-#if !defined(PIDGIN_GLOBAL_HEADER_INSIDE) && !defined(PIDGIN_COMPILATION)
-# error "only <pidgin.h> may be included directly"
-#endif
-
-#ifndef PIDGIN_NETWORK_PAGE_H
-#define PIDGIN_NETWORK_PAGE_H
-
-#include <glib.h>
-
-#include <gtk/gtk.h>
-#include <handy.h>
-
-G_BEGIN_DECLS
-
-/**
- * PidginNetworkPage:
- *
- * #PidginNetworkPage is a widget for the preferences window to let users
- * choose and configure their network settings.
- *
- * Since: 3.0.0
- */
-#define PIDGIN_TYPE_NETWORK_PAGE (pidgin_network_page_get_type())
-G_DECLARE_FINAL_TYPE(PidginNetworkPage, pidgin_network_page,
-                     PIDGIN, NETWORK_PAGE, HdyPreferencesPage)
-
-/**
- * pidgin_network_page_new:
- *
- * Creates a new #PidginNetworkPage instance.
- *
- * Returns: (transfer full): The new #PidginNetworkPage instance.
- *
- * Since: 3.0.0
- */
-GtkWidget *pidgin_network_page_new(void);
-
-G_END_DECLS
-
-#endif /* PIDGIN_NETWORK_PAGE_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pidgin/prefs/pidginnetworkprefs.c	Sun May 15 02:33:17 2022 -0500
@@ -0,0 +1,262 @@
+/*
+ * Pidgin - Internet Messenger
+ * Copyright (C) Pidgin Developers <devel@pidgin.im>
+ *
+ * Pidgin is the legal property of its developers, whose names are too numerous
+ * to list here.  Please refer to the COPYRIGHT file distributed with this
+ * source distribution.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses/>.
+ */
+
+#include <glib/gi18n-lib.h>
+
+#include <purple.h>
+
+#include <handy.h>
+#include <nice.h>
+
+#include "pidginnetworkprefs.h"
+#include "pidginprefsinternal.h"
+
+struct _PidginNetworkPrefs {
+	HdyPreferencesPage parent;
+
+	GtkWidget *stun_server;
+	GtkWidget *auto_ip;
+	GtkWidget *public_ip;
+	GtkWidget *public_ip_hbox;
+	GtkWidget *map_ports;
+	GtkWidget *ports_range_use;
+	GtkWidget *ports_range_hbox;
+	GtkWidget *ports_range_start;
+	GtkWidget *ports_range_end;
+	GtkWidget *turn_server;
+	GtkWidget *turn_port_udp;
+	GtkWidget *turn_port_tcp;
+	GtkWidget *turn_username;
+	GtkWidget *turn_password;
+};
+
+G_DEFINE_TYPE(PidginNetworkPrefs, pidgin_network_prefs,
+              HDY_TYPE_PREFERENCES_PAGE)
+
+/******************************************************************************
+ * Helpers
+ *****************************************************************************/
+static void
+network_ip_changed(GtkEntry *entry, gpointer data)
+{
+	const gchar *text = gtk_entry_get_text(entry);
+	GtkStyleContext *context = gtk_widget_get_style_context(GTK_WIDGET(entry));
+
+	if (text && *text) {
+		if (g_hostname_is_ip_address(text)) {
+			purple_network_set_public_ip(text);
+			gtk_style_context_add_class(context, "good-ip");
+			gtk_style_context_remove_class(context, "bad-ip");
+		} else {
+			gtk_style_context_add_class(context, "bad-ip");
+			gtk_style_context_remove_class(context, "good-ip");
+		}
+
+	} else {
+		purple_network_set_public_ip("");
+		gtk_style_context_remove_class(context, "bad-ip");
+		gtk_style_context_remove_class(context, "good-ip");
+	}
+}
+
+static gboolean
+network_stun_server_changed_cb(GtkWidget *widget,
+                               GdkEventFocus *event, gpointer data)
+{
+	GtkEntry *entry = GTK_ENTRY(widget);
+	purple_prefs_set_string("/purple/network/stun_server",
+		gtk_entry_get_text(entry));
+	purple_network_set_stun_server(gtk_entry_get_text(entry));
+
+	return FALSE;
+}
+
+static gboolean
+network_turn_server_changed_cb(GtkWidget *widget,
+                               GdkEventFocus *event, gpointer data)
+{
+	GtkEntry *entry = GTK_ENTRY(widget);
+	purple_prefs_set_string("/purple/network/turn_server",
+		gtk_entry_get_text(entry));
+	purple_network_set_turn_server(gtk_entry_get_text(entry));
+
+	return FALSE;
+}
+
+static void
+auto_ip_button_clicked_cb(GtkWidget *button, gpointer null)
+{
+	const char *ip;
+	PurpleStunNatDiscovery *stun;
+	char *auto_ip_text;
+	GList *list = NULL;
+
+	/* Make a lookup for the auto-detected IP ourselves. */
+	if (purple_prefs_get_bool("/purple/network/auto_ip")) {
+		/* Check if STUN discovery was already done */
+		stun = purple_stun_discover(NULL);
+		if ((stun != NULL) && (stun->status == PURPLE_STUN_STATUS_DISCOVERED)) {
+			ip = stun->publicip;
+		} else {
+			/* Attempt to get the IP from a NAT device using UPnP */
+			ip = purple_upnp_get_public_ip();
+			if (ip == NULL) {
+				/* Attempt to get the IP from a NAT device using NAT-PMP */
+				ip = purple_pmp_get_public_ip();
+				if (ip == NULL) {
+					/* Just fetch the first IP of the local system */
+					list = nice_interfaces_get_local_ips(FALSE);
+					if (list) {
+						ip = list->data;
+					} else {
+						ip = "0.0.0.0";
+					}
+				}
+			}
+		}
+	} else {
+		ip = _("Disabled");
+	}
+
+	auto_ip_text = g_strdup_printf(_("Use _automatically detected IP address: %s"), ip);
+	gtk_button_set_label(GTK_BUTTON(button), auto_ip_text);
+	g_free(auto_ip_text);
+	g_list_free_full(list, g_free);
+}
+
+/******************************************************************************
+ * GObject Implementation
+ *****************************************************************************/
+static void
+pidgin_network_prefs_class_init(PidginNetworkPrefsClass *klass)
+{
+	GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
+
+	gtk_widget_class_set_template_from_resource(
+		widget_class,
+		"/im/pidgin/Pidgin3/Prefs/network.ui"
+	);
+
+	gtk_widget_class_bind_template_child(widget_class, PidginNetworkPrefs,
+	                                     stun_server);
+	gtk_widget_class_bind_template_child(widget_class, PidginNetworkPrefs,
+	                                     auto_ip);
+	gtk_widget_class_bind_template_child(widget_class, PidginNetworkPrefs,
+	                                     public_ip);
+	gtk_widget_class_bind_template_child(widget_class, PidginNetworkPrefs,
+	                                     public_ip_hbox);
+	gtk_widget_class_bind_template_child(widget_class, PidginNetworkPrefs,
+	                                     map_ports);
+	gtk_widget_class_bind_template_child(widget_class, PidginNetworkPrefs,
+	                                     ports_range_use);
+	gtk_widget_class_bind_template_child(widget_class, PidginNetworkPrefs,
+	                                     ports_range_hbox);
+	gtk_widget_class_bind_template_child(widget_class, PidginNetworkPrefs,
+	                                     ports_range_start);
+	gtk_widget_class_bind_template_child(widget_class, PidginNetworkPrefs,
+	                                     ports_range_end);
+	gtk_widget_class_bind_template_child(widget_class, PidginNetworkPrefs,
+	                                     turn_server);
+	gtk_widget_class_bind_template_child(widget_class, PidginNetworkPrefs,
+	                                     turn_port_udp);
+	gtk_widget_class_bind_template_child(widget_class, PidginNetworkPrefs,
+	                                     turn_port_tcp);
+	gtk_widget_class_bind_template_child(widget_class, PidginNetworkPrefs,
+	                                     turn_username);
+	gtk_widget_class_bind_template_child(widget_class, PidginNetworkPrefs,
+	                                     turn_password);
+	gtk_widget_class_bind_template_callback(widget_class,
+	                                        network_stun_server_changed_cb);
+	gtk_widget_class_bind_template_callback(widget_class,
+	                                        auto_ip_button_clicked_cb);
+	gtk_widget_class_bind_template_callback(widget_class, network_ip_changed);
+	gtk_widget_class_bind_template_callback(widget_class,
+	                                        network_turn_server_changed_cb);
+}
+
+static void
+pidgin_network_prefs_init(PidginNetworkPrefs *prefs)
+{
+	GtkStyleContext *context;
+	GtkCssProvider *ip_css;
+
+	gtk_widget_init_template(GTK_WIDGET(prefs));
+
+	gtk_entry_set_text(GTK_ENTRY(prefs->stun_server),
+			purple_prefs_get_string("/purple/network/stun_server"));
+
+	pidgin_prefs_bind_checkbox("/purple/network/auto_ip", prefs->auto_ip);
+	auto_ip_button_clicked_cb(prefs->auto_ip, NULL); /* Update label */
+
+	gtk_entry_set_text(GTK_ENTRY(prefs->public_ip),
+			purple_network_get_public_ip());
+
+	ip_css = gtk_css_provider_new();
+	gtk_css_provider_load_from_resource(ip_css,
+	                                    "/im/pidgin/Pidgin3/Prefs/ip.css");
+
+	context = gtk_widget_get_style_context(prefs->public_ip);
+	gtk_style_context_add_provider(context,
+	                               GTK_STYLE_PROVIDER(ip_css),
+	                               GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+
+	g_object_bind_property(prefs->auto_ip, "active",
+			prefs->public_ip_hbox, "sensitive",
+			G_BINDING_SYNC_CREATE|G_BINDING_INVERT_BOOLEAN);
+
+	pidgin_prefs_bind_checkbox("/purple/network/map_ports",
+			prefs->map_ports);
+
+	pidgin_prefs_bind_checkbox("/purple/network/ports_range_use",
+			prefs->ports_range_use);
+	g_object_bind_property(prefs->ports_range_use, "active",
+			prefs->ports_range_hbox, "sensitive",
+			G_BINDING_SYNC_CREATE);
+
+	pidgin_prefs_bind_spin_button("/purple/network/ports_range_start",
+			prefs->ports_range_start);
+	pidgin_prefs_bind_spin_button("/purple/network/ports_range_end",
+			prefs->ports_range_end);
+
+	/* TURN server */
+	gtk_entry_set_text(GTK_ENTRY(prefs->turn_server),
+			purple_prefs_get_string("/purple/network/turn_server"));
+
+	pidgin_prefs_bind_spin_button("/purple/network/turn_port",
+			prefs->turn_port_udp);
+
+	pidgin_prefs_bind_spin_button("/purple/network/turn_port_tcp",
+			prefs->turn_port_tcp);
+
+	pidgin_prefs_bind_entry("/purple/network/turn_username",
+			prefs->turn_username);
+	pidgin_prefs_bind_entry("/purple/network/turn_password",
+			prefs->turn_password);
+}
+
+/******************************************************************************
+ * API
+ *****************************************************************************/
+GtkWidget *
+pidgin_network_prefs_new(void) {
+	return GTK_WIDGET(g_object_new(PIDGIN_TYPE_NETWORK_PREFS, NULL));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pidgin/prefs/pidginnetworkprefs.h	Sun May 15 02:33:17 2022 -0500
@@ -0,0 +1,62 @@
+/*
+ * Pidgin - Internet Messenger
+ * Copyright (C) Pidgin Developers <devel@pidgin.im>
+ *
+ * Pidgin is the legal property of its developers, whose names are too numerous
+ * to list here.  Please refer to the COPYRIGHT file distributed with this
+ * source distribution.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses/>.
+ */
+
+#if !defined(PIDGIN_GLOBAL_HEADER_INSIDE) && !defined(PIDGIN_COMPILATION)
+# error "only <pidgin.h> may be included directly"
+#endif
+
+#ifndef PIDGIN_NETWORK_PREFS_H
+#define PIDGIN_NETWORK_PREFS_H
+
+#include <glib.h>
+
+#include <gtk/gtk.h>
+#include <handy.h>
+
+G_BEGIN_DECLS
+
+/**
+ * PidginNetworkPrefs:
+ *
+ * #PidginNetworkPrefs is a widget for the preferences window to let users
+ * choose and configure their network settings.
+ *
+ * Since: 3.0.0
+ */
+#define PIDGIN_TYPE_NETWORK_PREFS (pidgin_network_prefs_get_type())
+G_DECLARE_FINAL_TYPE(PidginNetworkPrefs, pidgin_network_prefs,
+                     PIDGIN, NETWORK_PREFS, HdyPreferencesPage)
+
+/**
+ * pidgin_network_prefs_new:
+ *
+ * Creates a new #PidginNetworkPrefs instance.
+ *
+ * Returns: (transfer full): The new #PidginNetworkPrefs instance.
+ *
+ * Since: 3.0.0
+ */
+GtkWidget *pidgin_network_prefs_new(void);
+
+G_END_DECLS
+
+#endif /* PIDGIN_NETWORK_PREFS_H */
--- a/pidgin/resources/Prefs/network.ui	Sun May 15 02:33:17 2022 -0500
+++ b/pidgin/resources/Prefs/network.ui	Sun May 15 02:33:17 2022 -0500
@@ -44,7 +44,7 @@
     <property name="step-increment">1</property>
     <property name="page-increment">10</property>
   </object>
-  <template class="PidginNetworkPage" parent="HdyPreferencesPage">
+  <template class="PidginNetworkPrefs" parent="HdyPreferencesPage">
     <property name="visible">True</property>
     <property name="can-focus">False</property>
     <child>
--- a/pidgin/resources/Prefs/prefs.ui	Sun May 15 02:33:17 2022 -0500
+++ b/pidgin/resources/Prefs/prefs.ui	Sun May 15 02:33:17 2022 -0500
@@ -94,7 +94,7 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="PidginNetworkPage">
+                  <object class="PidginNetworkPrefs">
                     <property name="visible">True</property>
                     <property name="can-focus">False</property>
                   </object>

mercurial