--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/libpurple/plugins/notification-sound/im.pidgin.Purple.plugin.NotificationSound.gschema.xml Sun Sep 11 02:09:40 2022 -0500
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?> + <schema path="/plugins/notification-sound/" id="im.pidgin.Purple.plugin.NotificationSound"> + <key name="muted" type="b"> + <default>false</default> + <summary>Mute sounds</summary> + Whether notification sounds should be muted. + <key name="mute-until" type="s"> + <summary>Mute sounds until date</summary> + If notification sounds are muted, then they will be muted until the date + in this setting. The string must be a date in ISO8601 format, and will be + assumed in UTC if no time zone is specified. --- a/libpurple/plugins/notification-sound/meson.build Sun Sep 11 00:34:53 2022 -0500
+++ b/libpurple/plugins/notification-sound/meson.build Sun Sep 11 02:09:40 2022 -0500
@@ -8,4 +8,14 @@
install : true, install_dir : PURPLE_PLUGINDIR)
devenv.append('PURPLE_PLUGIN_PATH', meson.current_build_dir())
+ 'im.pidgin.Purple.plugin.NotificationSound.gschema.xml', + install_data(settings_schemas, install_dir: schemas_dir) + gnome.post_install(glib_compile_schemas: true) + # Compile the schemas in the current directory; this is only useful for testing + gnome.compile_schemas(depend_files: files(settings_schemas)) --- a/libpurple/plugins/notification-sound/notification-sound.c Sun Sep 11 00:34:53 2022 -0500
+++ b/libpurple/plugins/notification-sound/notification-sound.c Sun Sep 11 02:09:40 2022 -0500
@@ -34,9 +34,9 @@
#define PURPLE_NOTIFICATION_SOUND_DOMAIN \
g_quark_from_static_string("purple-notification-sound")
-#define PREF_ROOT "/plugins/core/notification-sound"
-#define PREF_MUTED PREF_ROOT "/muted"
-#define PREF_MUTE_UNTIL PREF_ROOT "/mute_until"
+#define SETTINGS_SCHEMA_ID "im.pidgin.Purple.plugin.NotificationSound" +#define PREF_MUTED "muted" +#define PREF_MUTE_UNTIL "mute-until" /******************************************************************************
@@ -50,11 +50,14 @@
*****************************************************************************/
purple_notification_sound_load_prefs(void) {
- const gchar *str_mute_until = NULL;
+ GSettings *settings = NULL; + gchar *str_mute_until = NULL; - muted = purple_prefs_get_bool(PREF_MUTED);
+ settings = g_settings_new_with_backend(SETTINGS_SCHEMA_ID, + purple_core_get_settings_backend()); + muted = g_settings_get_boolean(settings, PREF_MUTED); - str_mute_until = purple_prefs_get_string(PREF_MUTE_UNTIL);
+ str_mute_until = g_settings_get_string(settings, PREF_MUTE_UNTIL); if(str_mute_until != NULL && *str_mute_until != '\0') {
GTimeZone *tz = g_time_zone_new_utc();
@@ -62,19 +65,28 @@
+ g_free(str_mute_until); + g_object_unref(settings); purple_notification_sound_save_prefs(void) {
- gchar *str_mute_until = NULL;
+ GSettings *settings = NULL; + settings = g_settings_new_with_backend(SETTINGS_SCHEMA_ID, + purple_core_get_settings_backend()); + g_settings_set_boolean(settings, PREF_MUTED, muted); - str_mute_until = g_date_time_format_iso8601(mute_until);
+ gchar *str_mute_until = g_date_time_format_iso8601(mute_until); + g_settings_set_string(settings, PREF_MUTE_UNTIL, str_mute_until); + g_free(str_mute_until); + g_settings_set_string(settings, PREF_MUTE_UNTIL, ""); - purple_prefs_set_bool(PREF_MUTED, muted);
- purple_prefs_set_string(PREF_MUTE_UNTIL, str_mute_until);
- g_free(str_mute_until);
+ g_object_unref(settings); @@ -252,10 +264,6 @@
- purple_prefs_add_none(PREF_ROOT);
- purple_prefs_add_string(PREF_MUTE_UNTIL, NULL);
- purple_prefs_add_bool(PREF_MUTED, FALSE);
purple_notification_sound_load_prefs();
conv_handle = purple_conversations_get_handle();