]> code.delx.au - pulseaudio/blobdiff - src/modules/module-volume-restore.c
bluetooth: Fix possible adapter duplicates
[pulseaudio] / src / modules / module-volume-restore.c
index 21c714915f6635d71ef074c957a9275a24248840..a344c5eba6cc00822561a72462b4d7a44a46307d 100644 (file)
@@ -5,7 +5,7 @@
 
   PulseAudio is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as published
 
   PulseAudio is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as published
-  by the Free Software Foundation; either version 2 of the License,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -36,6 +36,7 @@ PA_MODULE_AUTHOR("Lennart Poettering");
 PA_MODULE_DESCRIPTION("Compatibility module");
 PA_MODULE_VERSION(PACKAGE_VERSION);
 PA_MODULE_LOAD_ONCE(TRUE);
 PA_MODULE_DESCRIPTION("Compatibility module");
 PA_MODULE_VERSION(PACKAGE_VERSION);
 PA_MODULE_LOAD_ONCE(TRUE);
+PA_MODULE_DEPRECATED("Please use module-stream-restore instead of module-volume-restore!");
 
 static const char* const valid_modargs[] = {
     "table",
 
 static const char* const valid_modargs[] = {
     "table",
@@ -47,6 +48,7 @@ static const char* const valid_modargs[] = {
 int pa__init(pa_module*m) {
     pa_modargs *ma = NULL;
     pa_bool_t restore_device = TRUE, restore_volume = TRUE;
 int pa__init(pa_module*m) {
     pa_modargs *ma = NULL;
     pa_bool_t restore_device = TRUE, restore_volume = TRUE;
+    pa_module *n;
     char *t;
 
     pa_assert(m);
     char *t;
 
     pa_assert(m);
@@ -62,20 +64,22 @@ int pa__init(pa_module*m) {
         goto fail;
     }
 
         goto fail;
     }
 
-    pa_log_warn("module-volume-restore is obsolete. It has been replaced by module-stream-restore. We will now load the latter but please make sure to remove module-volume-restore from your configuration.");
+    pa_log_warn("We will now load module-stream-restore. Please make sure to remove module-volume-restore from your configuration.");
 
     t = pa_sprintf_malloc("restore_volume=%s restore_device=%s", pa_yes_no(restore_volume), pa_yes_no(restore_device));
 
     t = pa_sprintf_malloc("restore_volume=%s restore_device=%s", pa_yes_no(restore_volume), pa_yes_no(restore_device));
-    pa_module_load(m->core, "module-stream-restore", t);
+    n = pa_module_load(m->core, "module-stream-restore", t);
     pa_xfree(t);
 
     pa_xfree(t);
 
-    pa_module_unload_request(m, TRUE);
+    if (n)
+        pa_module_unload_request(m, TRUE);
 
     pa_modargs_free(ma);
 
     pa_modargs_free(ma);
-    return 0;
+
+    return n ? 0 : -1;
 
 fail:
     if (ma)
         pa_modargs_free(ma);
 
 
 fail:
     if (ma)
         pa_modargs_free(ma);
 
-    return  -1;
+    return -1;
 }
 }