Add a Developer Settings preference pane

Thu, 15 May 2025 22:55:59 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Thu, 15 May 2025 22:55:59 -0500
changeset 43256
22c942d20e9e
parent 43255
828626110810
child 43257
934732945514

Add a Developer Settings preference pane

Right now this just toggles the purple developer-mode setting

Testing Done:
Toggled the preference a few times and verified the keyfile was updated for it. Also called in the turtles.

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

pidgin/meson.build file | annotate | diff | comparison | revisions
pidgin/prefs/pidgindeveloperprefs.c file | annotate | diff | comparison | revisions
pidgin/prefs/pidgindeveloperprefs.h file | annotate | diff | comparison | revisions
pidgin/resources/Prefs/developer.ui file | annotate | diff | comparison | revisions
pidgin/resources/Prefs/prefs.ui file | annotate | diff | comparison | revisions
pidgin/resources/pidgin.gresource.xml file | annotate | diff | comparison | revisions
po/POTFILES.in file | annotate | diff | comparison | revisions
--- a/pidgin/meson.build	Thu May 15 22:51:53 2025 -0500
+++ b/pidgin/meson.build	Thu May 15 22:55:59 2025 -0500
@@ -50,6 +50,7 @@
 	'prefs/pidginawayprefs.c',
 	'prefs/pidgincredentialproviderrow.c',
 	'prefs/pidgincredentialprefs.c',
+	'prefs/pidgindeveloperprefs.c',
 	'prefs/pidginnetworkprefs.c',
 	'prefs/pidginprefs.c',
 	'prefs/pidginprivacyprefs.c',
@@ -108,6 +109,7 @@
 	'prefs/pidginawayprefs.h',
 	'prefs/pidgincredentialproviderrow.h',
 	'prefs/pidgincredentialprefs.h',
+	'prefs/pidgindeveloperprefs.h',
 	'prefs/pidginnetworkprefs.h',
 	'prefs/pidginprefs.h',
 	'prefs/pidginprivacyprefs.h',
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pidgin/prefs/pidgindeveloperprefs.c	Thu May 15 22:55:59 2025 -0500
@@ -0,0 +1,74 @@
+/*
+ * 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 <adwaita.h>
+
+#include "pidgindeveloperprefs.h"
+#include "pidgincore.h"
+
+struct _PidginDeveloperPrefs {
+	AdwPreferencesPage parent;
+
+	GtkWidget *developer_mode;
+};
+
+G_DEFINE_FINAL_TYPE(PidginDeveloperPrefs, pidgin_developer_prefs,
+                    ADW_TYPE_PREFERENCES_PAGE)
+
+/******************************************************************************
+ * GObject Implementation
+ *****************************************************************************/
+static void
+pidgin_developer_prefs_class_init(PidginDeveloperPrefsClass *klass) {
+	GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
+
+	gtk_widget_class_set_template_from_resource(widget_class,
+	                                            "/im/pidgin/Pidgin3/Prefs/developer.ui");
+
+	gtk_widget_class_bind_template_child(widget_class, PidginDeveloperPrefs,
+	                                     developer_mode);
+}
+
+static void
+pidgin_developer_prefs_init(PidginDeveloperPrefs *prefs) {
+	GSettings *settings = NULL;
+
+	gtk_widget_init_template(GTK_WIDGET(prefs));
+
+	settings = purple_core_new_settings("im.pidgin.Purple.Core");
+	g_settings_bind(settings, "developer-mode",
+	                prefs->developer_mode, "active",
+	                G_SETTINGS_BIND_DEFAULT);
+	g_clear_object(&settings);
+}
+
+/******************************************************************************
+ * API
+ *****************************************************************************/
+GtkWidget *
+pidgin_developer_prefs_new(void) {
+	return g_object_new(PIDGIN_TYPE_DEVELOPER_PREFS, NULL);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pidgin/prefs/pidgindeveloperprefs.h	Thu May 15 22:55:59 2025 -0500
@@ -0,0 +1,67 @@
+/*
+ * 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_DEVELOPER_PREFS_H
+#define PIDGIN_DEVELOPER_PREFS_H
+
+#include <glib.h>
+
+#include <gtk/gtk.h>
+#include <adwaita.h>
+
+#include "pidginversion.h"
+
+G_BEGIN_DECLS
+
+/**
+ * PidginDeveloperPrefs:
+ *
+ * A widget for the preferences window to let users choose and configure their
+ * developer settings.
+ *
+ * Since: 3.0
+ */
+#define PIDGIN_TYPE_DEVELOPER_PREFS (pidgin_developer_prefs_get_type())
+
+PIDGIN_AVAILABLE_IN_3_0
+G_DECLARE_FINAL_TYPE(PidginDeveloperPrefs, pidgin_developer_prefs,
+                     PIDGIN, DEVELOPER_PREFS, AdwPreferencesPage)
+
+/**
+ * pidgin_developer_prefs_new:
+ *
+ * Creates a new developer preferences instance.
+ *
+ * Returns: (transfer full) (type PidginDeveloperPrefs): The new instance.
+ *
+ * Since: 3.0
+ */
+PIDGIN_AVAILABLE_IN_3_0
+GtkWidget *pidgin_developer_prefs_new(void);
+
+G_END_DECLS
+
+#endif /* PIDGIN_DEVELOPER_PREFS_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pidgin/resources/Prefs/developer.ui	Thu May 15 22:55:59 2025 -0500
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Pidgin - Internet Messenger
+Copyright (C) Pidgin Developers <devel@pidgin.im>
+
+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/>.
+-->
+<interface>
+  <requires lib="gtk" version="4.0"/>
+  <requires lib="Adw" version="1.0"/>
+  <!-- interface-license-type gplv2 -->
+  <!-- interface-name Pidgin -->
+  <!-- interface-description Internet Messenger -->
+  <!-- interface-copyright Pidgin Developers <devel@pidgin.im> -->
+  <template class="PidginDeveloperPrefs" parent="AdwPreferencesPage">
+    <property name="icon-name">preferences-system-symbolic</property>
+    <property name="title" translatable="yes">Development</property>
+    <child>
+      <object class="AdwPreferencesGroup">
+        <property name="title" translatable="yes">Development Settings</property>
+        <child>
+          <object class="AdwSwitchRow" id="developer_mode">
+            <property name="title" translatable="yes">_Developer Mode</property>
+            <property name="use-underline">true</property>
+          </object>
+        </child>
+      </object>
+    </child>
+  </template>
+</interface>
--- a/pidgin/resources/Prefs/prefs.ui	Thu May 15 22:51:53 2025 -0500
+++ b/pidgin/resources/Prefs/prefs.ui	Thu May 15 22:55:59 2025 -0500
@@ -53,5 +53,8 @@
       <object class="PidginVVPrefs" id="vv"/>
     </child>
     -->
+    <child>
+      <object class="PidginDeveloperPrefs"/>
+    </child>
   </template>
 </interface>
--- a/pidgin/resources/pidgin.gresource.xml	Thu May 15 22:51:53 2025 -0500
+++ b/pidgin/resources/pidgin.gresource.xml	Thu May 15 22:55:59 2025 -0500
@@ -18,6 +18,7 @@
     <file compressed="true" preprocess="xml-stripblanks">Prefs/away.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">Prefs/credentials.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">Prefs/credentialprovider.ui</file>
+    <file compressed="true" preprocess="xml-stripblanks">Prefs/developer.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">Prefs/network.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">Prefs/prefs.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">Prefs/privacy.ui</file>
--- a/po/POTFILES.in	Thu May 15 22:51:53 2025 -0500
+++ b/po/POTFILES.in	Thu May 15 22:55:59 2025 -0500
@@ -118,6 +118,7 @@
 pidgin/prefs/pidginawayprefs.c
 pidgin/prefs/pidgincredentialprefs.c
 pidgin/prefs/pidgincredentialproviderrow.c
+pidgin/prefs/pidgindeveloperprefs.c
 pidgin/prefs/pidginnetworkprefs.c
 pidgin/prefs/pidginprefs.c
 pidgin/prefs/pidginprivacyprefs.c
@@ -140,6 +141,7 @@
 pidgin/resources/Prefs/away.ui
 pidgin/resources/Prefs/credentialprovider.ui
 pidgin/resources/Prefs/credentials.ui
+pidgin/resources/Prefs/developer.ui
 pidgin/resources/Prefs/network.ui
 pidgin/resources/Prefs/prefs.ui
 pidgin/resources/Prefs/privacy.ui

mercurial