# HG changeset patch # User Gary Kramlich # Date 1747164546 18000 # Node ID 8bd7eee2f178b0702859ee2f9611613522be0530 # Parent 9ddd095b0a0b4a38156db3a503fac2b63730ec6e Create a Privacy preference page with the send typing notification preference This only controls whether or not the conversation window will send typing notifications, plugins can still do this on their own. Testing Done: Used ngrep to verify if the irc typing messages were being sent or not. Also manually modified the settings file and verified the ui update and vice versa. Bugs closed: PIDGIN-17450 Reviewed at https://reviews.imfreedom.org/r/3999/ diff -r 9ddd095b0a0b -r 8bd7eee2f178 libpurple/data/im.pidgin.Purple.gschema.xml --- a/libpurple/data/im.pidgin.Purple.gschema.xml Tue May 13 00:56:10 2025 -0500 +++ b/libpurple/data/im.pidgin.Purple.gschema.xml Tue May 13 14:29:06 2025 -0500 @@ -15,17 +15,6 @@ - - - true - Send typing notifications - - Send a notification when you are typing to any conversation that - supports it. - - - - "noop-provider" diff -r 9ddd095b0a0b -r 8bd7eee2f178 pidgin/data/gschema/im.pidgin.Pidgin3.Preferences.gschema.xml --- a/pidgin/data/gschema/im.pidgin.Pidgin3.Preferences.gschema.xml Tue May 13 00:56:10 2025 -0500 +++ b/pidgin/data/gschema/im.pidgin.Pidgin3.Preferences.gschema.xml Tue May 13 14:29:06 2025 -0500 @@ -9,4 +9,13 @@ + + + true + Send typing notifications + + Whether or not typing notifications will be sent. + + + diff -r 9ddd095b0a0b -r 8bd7eee2f178 pidgin/meson.build --- a/pidgin/meson.build Tue May 13 00:56:10 2025 -0500 +++ b/pidgin/meson.build Tue May 13 14:29:06 2025 -0500 @@ -46,12 +46,13 @@ 'pidginprotocolchooser.c', 'pidgintypinglabel.c', 'pidginui.c', - 'prefs/pidginprefs.c', 'prefs/pidginappearanceprefs.c', 'prefs/pidginawayprefs.c', 'prefs/pidgincredentialproviderrow.c', 'prefs/pidgincredentialprefs.c', 'prefs/pidginnetworkprefs.c', + 'prefs/pidginprefs.c', + 'prefs/pidginprivacyprefs.c', 'prefs/pidginproxyprefs.c', ] @@ -103,12 +104,13 @@ ] libpidgin_prefs_headers = [ - 'prefs/pidginprefs.h', 'prefs/pidginappearanceprefs.h', 'prefs/pidginawayprefs.h', 'prefs/pidgincredentialproviderrow.h', 'prefs/pidgincredentialprefs.h', 'prefs/pidginnetworkprefs.h', + 'prefs/pidginprefs.h', + 'prefs/pidginprivacyprefs.h', 'prefs/pidginproxyprefs.h', ] diff -r 9ddd095b0a0b -r 8bd7eee2f178 pidgin/pidginconversation.c --- a/pidgin/pidginconversation.c Tue May 13 00:56:10 2025 -0500 +++ b/pidgin/pidginconversation.c Tue May 13 14:29:06 2025 -0500 @@ -52,6 +52,8 @@ PurpleConversation *conversation; + GSettings *privacy_settings; + GtkWidget *info_pane; GtkWidget *history; GtkAdjustment *history_adjustment; @@ -297,8 +299,12 @@ { PidginConversation *conversation = data; - purple_conversation_set_typing_state(conversation->conversation, - PURPLE_TYPING_STATE_TYPING); + if(g_settings_get_boolean(conversation->privacy_settings, + "send-typing-notifications")) + { + purple_conversation_set_typing_state(conversation->conversation, + PURPLE_TYPING_STATE_TYPING); + } } static void @@ -310,8 +316,12 @@ PidginConversation *conversation = data; if(gtk_text_buffer_get_char_count(buffer) == 0) { - purple_conversation_set_typing_state(conversation->conversation, - PURPLE_TYPING_STATE_NONE); + if(g_settings_get_boolean(conversation->privacy_settings, + "send-typing-notifications")) + { + purple_conversation_set_typing_state(conversation->conversation, + PURPLE_TYPING_STATE_NONE); + } } } @@ -456,7 +466,6 @@ G_IMPLEMENT_INTERFACE(PIDGIN_TYPE_NOTIFIABLE, pidgin_conversation_notifiable_init)) - static void pidgin_conversation_dispose(GObject *obj) { PidginConversation *conversation = PIDGIN_CONVERSATION(obj); @@ -469,6 +478,15 @@ } static void +pidgin_conversation_finalize(GObject *obj) { + PidginConversation *conversation = PIDGIN_CONVERSATION(obj); + + g_clear_object(&conversation->privacy_settings); + + G_OBJECT_CLASS(pidgin_conversation_parent_class)->finalize(obj); +} + +static void pidgin_conversation_get_property(GObject *obj, guint param_id, GValue *value, GParamSpec *pspec) { @@ -518,6 +536,10 @@ gtk_widget_init_template(GTK_WIDGET(conversation)); + conversation->privacy_settings = + g_settings_new_with_backend("im.pidgin.Pidgin3.Privacy", + purple_core_get_settings_backend()); + gtk_custom_sorter_set_sort_func(conversation->member_list_sorter, pidgin_conversation_member_list_sort, NULL, NULL); @@ -551,6 +573,7 @@ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); obj_class->dispose = pidgin_conversation_dispose; + obj_class->finalize = pidgin_conversation_finalize; obj_class->get_property = pidgin_conversation_get_property; obj_class->set_property = pidgin_conversation_set_property; diff -r 9ddd095b0a0b -r 8bd7eee2f178 pidgin/prefs/pidginprivacyprefs.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pidgin/prefs/pidginprivacyprefs.c Tue May 13 14:29:06 2025 -0500 @@ -0,0 +1,75 @@ +/* + * Pidgin - Internet Messenger + * Copyright (C) Pidgin Developers + * + * 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 . + */ + +#include + +#include + +#include + +#include "pidginprivacyprefs.h" +#include "pidgincore.h" + +struct _PidginPrivacyPrefs { + AdwPreferencesPage parent; + + GtkWidget *send_typing_notifications; +}; + +G_DEFINE_FINAL_TYPE(PidginPrivacyPrefs, pidgin_privacy_prefs, + ADW_TYPE_PREFERENCES_PAGE) + +/****************************************************************************** + * GObject Implementation + *****************************************************************************/ +static void +pidgin_privacy_prefs_class_init(PidginPrivacyPrefsClass *klass) { + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); + + gtk_widget_class_set_template_from_resource(widget_class, + "/im/pidgin/Pidgin3/Prefs/privacy.ui"); + + gtk_widget_class_bind_template_child(widget_class, PidginPrivacyPrefs, + send_typing_notifications); +} + +static void +pidgin_privacy_prefs_init(PidginPrivacyPrefs *prefs) { + GSettings *settings = NULL; + + gtk_widget_init_template(GTK_WIDGET(prefs)); + + settings = g_settings_new_with_backend("im.pidgin.Pidgin3.Privacy", + purple_core_get_settings_backend()); + g_settings_bind(settings, "send-typing-notifications", + prefs->send_typing_notifications, "active", + G_SETTINGS_BIND_DEFAULT); + g_clear_object(&settings); +} + +/****************************************************************************** + * API + *****************************************************************************/ +GtkWidget * +pidgin_privacy_prefs_new(void) { + return g_object_new(PIDGIN_TYPE_PRIVACY_PREFS, NULL); +} diff -r 9ddd095b0a0b -r 8bd7eee2f178 pidgin/prefs/pidginprivacyprefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pidgin/prefs/pidginprivacyprefs.h Tue May 13 14:29:06 2025 -0500 @@ -0,0 +1,67 @@ +/* + * Pidgin - Internet Messenger + * Copyright (C) Pidgin Developers + * + * 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 . + */ + +#if !defined(PIDGIN_GLOBAL_HEADER_INSIDE) && !defined(PIDGIN_COMPILATION) +# error "only may be included directly" +#endif + +#ifndef PIDGIN_PRIVACY_PREFS_H +#define PIDGIN_PRIVACY_PREFS_H + +#include + +#include +#include + +#include "pidginversion.h" + +G_BEGIN_DECLS + +/** + * PidginPrivacyPrefs: + * + * A widget for the preferences window to let users choose and configure their + * privacy settings. + * + * Since: 3.0 + */ +#define PIDGIN_TYPE_PRIVACY_PREFS (pidgin_privacy_prefs_get_type()) + +PIDGIN_AVAILABLE_IN_3_0 +G_DECLARE_FINAL_TYPE(PidginPrivacyPrefs, pidgin_privacy_prefs, + PIDGIN, PRIVACY_PREFS, AdwPreferencesPage) + +/** + * pidgin_privacy_prefs_new: + * + * Creates a new privacy preferences instance. + * + * Returns: (transfer full) (type PidginPrivacyPrefs): The new instance. + * + * Since: 3.0 + */ +PIDGIN_AVAILABLE_IN_3_0 +GtkWidget *pidgin_privacy_prefs_new(void); + +G_END_DECLS + +#endif /* PIDGIN_PRIVACY_PREFS_H */ diff -r 9ddd095b0a0b -r 8bd7eee2f178 pidgin/resources/Prefs/prefs.ui --- a/pidgin/resources/Prefs/prefs.ui Tue May 13 00:56:10 2025 -0500 +++ b/pidgin/resources/Prefs/prefs.ui Tue May 13 14:29:06 2025 -0500 @@ -34,6 +34,9 @@ + + + diff -r 9ddd095b0a0b -r 8bd7eee2f178 pidgin/resources/Prefs/privacy.ui --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pidgin/resources/Prefs/privacy.ui Tue May 13 14:29:06 2025 -0500 @@ -0,0 +1,41 @@ + + + + + + + + + + + diff -r 9ddd095b0a0b -r 8bd7eee2f178 pidgin/resources/pidgin.gresource.xml --- a/pidgin/resources/pidgin.gresource.xml Tue May 13 00:56:10 2025 -0500 +++ b/pidgin/resources/pidgin.gresource.xml Tue May 13 14:29:06 2025 -0500 @@ -20,6 +20,7 @@ Prefs/credentialprovider.ui Prefs/network.ui Prefs/prefs.ui + Prefs/privacy.ui Prefs/proxy.ui Prefs/vv.ui Protocols/chooser.ui diff -r 9ddd095b0a0b -r 8bd7eee2f178 po/POTFILES.in --- a/po/POTFILES.in Tue May 13 00:56:10 2025 -0500 +++ b/po/POTFILES.in Tue May 13 14:29:06 2025 -0500 @@ -120,6 +120,7 @@ pidgin/prefs/pidgincredentialproviderrow.c pidgin/prefs/pidginnetworkprefs.c pidgin/prefs/pidginprefs.c +pidgin/prefs/pidginprivacy.c pidgin/prefs/pidginproxyprefs.c pidgin/prefs/pidginvvprefs.c pidgin/resources/About/about.ui @@ -141,6 +142,7 @@ pidgin/resources/Prefs/credentials.ui pidgin/resources/Prefs/network.ui pidgin/resources/Prefs/prefs.ui +pidgin/resources/Prefs/privacy.ui pidgin/resources/Prefs/proxy.ui pidgin/resources/Prefs/vv.ui pidgin/resources/Protocols/chooser.ui