Remove Purple prefs -> Pidgin UI bindings

Tue, 15 Oct 2024 01:17:01 -0500

author
Elliott Sales de Andrade <quantum.analyst@gmail.com>
date
Tue, 15 Oct 2024 01:17:01 -0500
changeset 43013
26d30c0db9a5
parent 43012
e34bd482a051
child 43014
8194d922bd07

Remove Purple prefs -> Pidgin UI bindings

These are unused apart from the commented out conversation prefs now that
everything is on `GSettings`.

Testing Done:
Compiled with no errors.

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

pidgin/prefs/pidginawayprefs.c file | annotate | diff | comparison | revisions
pidgin/prefs/pidginconversationprefs.c file | annotate | diff | comparison | revisions
pidgin/prefs/pidginnetworkprefs.c file | annotate | diff | comparison | revisions
pidgin/prefs/pidginprefs.c file | annotate | diff | comparison | revisions
pidgin/prefs/pidginprefsinternal.h file | annotate | diff | comparison | revisions
pidgin/prefs/pidginproxyprefs.c file | annotate | diff | comparison | revisions
--- a/pidgin/prefs/pidginawayprefs.c	Tue Oct 15 00:59:23 2024 -0500
+++ b/pidgin/prefs/pidginawayprefs.c	Tue Oct 15 01:17:01 2024 -0500
@@ -28,7 +28,6 @@
 
 #include "pidginawayprefs.h"
 #include "pidginiconname.h"
-#include "pidginprefsinternal.h"
 
 struct _PidginAwayPrefs {
 	AdwPreferencesPage parent;
--- a/pidgin/prefs/pidginconversationprefs.c	Tue Oct 15 00:59:23 2024 -0500
+++ b/pidgin/prefs/pidginconversationprefs.c	Tue Oct 15 01:17:01 2024 -0500
@@ -28,7 +28,6 @@
 
 #include "pidginconversationprefs.h"
 #include "pidgincore.h"
-#include "pidginprefsinternal.h"
 
 struct _PidginConversationPrefs {
 	AdwPreferencesPage parent;
--- a/pidgin/prefs/pidginnetworkprefs.c	Tue Oct 15 00:59:23 2024 -0500
+++ b/pidgin/prefs/pidginnetworkprefs.c	Tue Oct 15 01:17:01 2024 -0500
@@ -27,7 +27,6 @@
 #include <adwaita.h>
 
 #include "pidginnetworkprefs.h"
-#include "pidginprefsinternal.h"
 
 struct _PidginNetworkPrefs {
 	AdwPreferencesPage parent;
--- a/pidgin/prefs/pidginprefs.c	Tue Oct 15 00:59:23 2024 -0500
+++ b/pidgin/prefs/pidginprefs.c	Tue Oct 15 01:17:01 2024 -0500
@@ -33,7 +33,6 @@
 #include <adwaita.h>
 
 #include "pidginprefs.h"
-#include "pidginprefsinternal.h"
 #include "pidgincore.h"
 #if 0
 #include "pidginvvprefs.h"
@@ -48,141 +47,6 @@
 /******************************************************************************
  * Helpers
  *****************************************************************************/
-static void
-update_spin_value(G_GNUC_UNUSED GtkWidget *w, GtkWidget *spin)
-{
-	const char *key = g_object_get_data(G_OBJECT(spin), "val");
-	int value;
-
-	value = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin));
-
-	purple_prefs_set_int(key, value);
-}
-
-void
-pidgin_prefs_bind_spin_button(const char *key, GtkWidget *spin)
-{
-	GtkAdjustment *adjust;
-	int val;
-
-	val = purple_prefs_get_int(key);
-
-	adjust = gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(spin));
-	gtk_adjustment_set_value(adjust, val);
-	g_object_set_data(G_OBJECT(spin), "val", (char *)key);
-	g_signal_connect(G_OBJECT(adjust), "value-changed",
-			G_CALLBACK(update_spin_value), GTK_WIDGET(spin));
-}
-
-static void
-entry_set(GtkEntry *entry, gpointer data)
-{
-	const char *key = (const char*)data;
-
-	purple_prefs_set_string(key, gtk_editable_get_text(GTK_EDITABLE(entry)));
-}
-
-void
-pidgin_prefs_bind_entry(const char *key, GtkWidget *entry)
-{
-	const gchar *value;
-
-	value = purple_prefs_get_string(key);
-
-	gtk_editable_set_text(GTK_EDITABLE(entry), value);
-	g_signal_connect(G_OBJECT(entry), "changed", G_CALLBACK(entry_set),
-			(char*)key);
-}
-
-static void
-bind_combo_row_set(GObject *obj, G_GNUC_UNUSED GParamSpec *pspec,
-                   gpointer data)
-{
-	const gchar *key = data;
-	GtkStringObject *item = NULL;
-	const gchar *value = NULL;
-
-	item = adw_combo_row_get_selected_item(ADW_COMBO_ROW(obj));
-	value = gtk_string_object_get_string(item);
-	purple_prefs_set_string(key, value);
-}
-
-void
-pidgin_prefs_bind_combo_row(const gchar *key, GtkWidget *widget) {
-	GtkStringList *model = NULL;
-	const char *pref_value = NULL;
-	guint selected = GTK_INVALID_LIST_POSITION;
-
-	pref_value = purple_prefs_get_string(key);
-	model = GTK_STRING_LIST(adw_combo_row_get_model(ADW_COMBO_ROW(widget)));
-
-	for(guint i = 0; i < g_list_model_get_n_items(G_LIST_MODEL(model)); i++) {
-		const char *value = gtk_string_list_get_string(model, i);
-
-		if (purple_strequal(pref_value, value)) {
-			selected = i;
-			break;
-		}
-	}
-
-	adw_combo_row_set_selected(ADW_COMBO_ROW(widget), selected);
-
-	g_signal_connect(widget, "notify::selected",
-	                 G_CALLBACK(bind_combo_row_set), (gpointer)key);
-}
-
-static void
-set_bool_pref(GtkWidget *w, const char *key)
-{
-	purple_prefs_set_bool(key,
-			gtk_check_button_get_active(GTK_CHECK_BUTTON(w)));
-}
-
-void
-pidgin_prefs_bind_checkbox(const char *key, GtkWidget *button)
-{
-	gtk_check_button_set_active(GTK_CHECK_BUTTON(button),
-			purple_prefs_get_bool(key));
-	g_signal_connect(G_OBJECT(button), "toggled",
-			G_CALLBACK(set_bool_pref), (char *)key);
-}
-
-static void
-set_bool_switch_pref(GObject *obj, G_GNUC_UNUSED GParamSpec *pspec,
-                     gpointer data)
-{
-	const gchar *key = data;
-
-	purple_prefs_set_bool(key, gtk_switch_get_active(GTK_SWITCH(obj)));
-}
-
-void
-pidgin_prefs_bind_switch(const gchar *key, GtkWidget *widget)
-{
-	gtk_switch_set_active(GTK_SWITCH(widget), purple_prefs_get_bool(key));
-	g_signal_connect(widget, "notify::active",
-	                 G_CALLBACK(set_bool_switch_pref), (gchar *)key);
-}
-
-static void
-set_expander_row_pref(GObject *obj, G_GNUC_UNUSED GParamSpec *pspec,
-                     gpointer data)
-{
-	const gchar *key = data;
-	gboolean enabled;
-
-	enabled = adw_expander_row_get_enable_expansion(ADW_EXPANDER_ROW(obj));
-	purple_prefs_set_bool(key, enabled);
-}
-
-void
-pidgin_prefs_bind_expander_row(const gchar *key, GtkWidget *widget)
-{
-	adw_expander_row_set_enable_expansion(ADW_EXPANDER_ROW(widget),
-	                                      purple_prefs_get_bool(key));
-	g_signal_connect(widget, "notify::enable-expansion",
-	                 G_CALLBACK(set_expander_row_pref), (gchar *)key);
-}
 
 #if 0
 static void
--- a/pidgin/prefs/pidginprefsinternal.h	Tue Oct 15 00:59:23 2024 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +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_PREFS_INTERNAL_H
-#define PIDGIN_PREFS_INTERNAL_H
-
-#include <purple.h>
-
-typedef struct _PidginPrefCombo PidginPrefCombo;
-
-struct _PidginPrefCombo {
-	GtkWidget *combo;
-	PurplePrefType type;
-	const gchar *key;
-};
-
-enum {
-	PIDGIN_PREF_COMBO_TEXT,
-	PIDGIN_PREF_COMBO_VALUE,
-	PIDGIN_PREF_COMBO_N_COLUMNS
-};
-
-G_BEGIN_DECLS
-
-G_GNUC_INTERNAL
-void pidgin_prefs_bind_checkbox(const char *key, GtkWidget *button);
-
-G_GNUC_INTERNAL
-void pidgin_prefs_bind_combo_row(const gchar *key, GtkWidget *widget);
-
-G_GNUC_INTERNAL
-void pidgin_prefs_bind_dropdown(PidginPrefCombo *combo);
-
-G_GNUC_INTERNAL
-void pidgin_prefs_bind_entry(const char *key, GtkWidget *entry);
-
-G_GNUC_INTERNAL
-void pidgin_prefs_bind_expander_row(const gchar *key, GtkWidget *widget);
-
-G_GNUC_INTERNAL
-void pidgin_prefs_bind_spin_button(const char *key, GtkWidget *spin);
-
-G_GNUC_INTERNAL
-void pidgin_prefs_bind_switch(const gchar *key, GtkWidget *widget);
-
-G_END_DECLS
-
-#endif /* PIDGIN_PREFS_INTERNAL_H */
--- a/pidgin/prefs/pidginproxyprefs.c	Tue Oct 15 00:59:23 2024 -0500
+++ b/pidgin/prefs/pidginproxyprefs.c	Tue Oct 15 01:17:01 2024 -0500
@@ -27,7 +27,6 @@
 #include <adwaita.h>
 
 #include "pidginproxyprefs.h"
-#include "pidginprefsinternal.h"
 
 struct _PidginProxyPrefs {
 	AdwPreferencesPage parent;

mercurial