[Xfce4-commits] [apps/xfce4-volumed-pulse] 32/62: drop card/track properties from xfconf
noreply at xfce.org
noreply at xfce.org
Thu Sep 8 10:32:54 CEST 2016
This is an automated email from the git hooks/post-receive script.
ochosi pushed a commit to branch master
in repository apps/xfce4-volumed-pulse.
commit d4118f3d5e9edfc5716750f672c929eeefd75b57
Author: Lionel Le Folgoc <lionel at lefolgoc.net>
Date: Thu May 24 20:25:44 2012 +0200
drop card/track properties from xfconf
We only want to use whatever sink is set as default by pulseaudio.
---
src/xvd_xfconf.c | 178 +------------------------------------------------------
src/xvd_xfconf.h | 12 ----
2 files changed, 1 insertion(+), 189 deletions(-)
diff --git a/src/xvd_xfconf.c b/src/xvd_xfconf.c
index a875437..1c9319f 100644
--- a/src/xvd_xfconf.c
+++ b/src/xvd_xfconf.c
@@ -18,115 +18,6 @@
*/
#include "xvd_xfconf.h"
-#include "xvd_mixer.h"
-
-static void
-_xvd_xfconf_reinit_card(XvdInstance *Inst)
-{
- gchar *previous_card = NULL;
-
- if (!xvd_xfconf_get_card (Inst)) {
- // If we fail to get an xfconf card, we save the current one in xfconf
- if (Inst->card_name != NULL) {
- xvd_xfconf_set_card (Inst, Inst->card_name);
- Inst->xfconf_card_name = g_strdup (Inst->card_name);
- }
- // If the current card is NULL too, we do nothing
- return;
- }
-
- // If the card set in xfconf is the same as the currently used one, we do nothing
- if ((Inst->card_name != NULL) && (g_strcmp0 (Inst->xfconf_card_name, Inst->card_name) == 0)) {
- return;
- }
-
- // We now try to replace it with the one set in xfconf
- previous_card = g_strdup (Inst->card_name);
- xvd_get_card_from_mixer (Inst, Inst->xfconf_card_name, previous_card);
-
- // At this stage the track grabbed is wrong, but we expect the user to also update the track key
-
- // We check if the card has been correctly set
- if ((Inst->card_name == NULL) || (g_strcmp0 (Inst->xfconf_card_name, Inst->card_name) != 0)) {
- g_debug ("The card chosen in xfconf could not be set, another one was set instead\nChosen: %s\nSet: %s\n",
- Inst->xfconf_card_name,
- Inst->card_name);
- // If not, we save the valid card in xfconf instead of the user chosen
- // TODO we should actually refresh the mixers prior to finding the new card
- xvd_xfconf_set_card (Inst, Inst->card_name);
- g_free (Inst->xfconf_card_name);
- Inst->xfconf_card_name = g_strdup (Inst->card_name);
- }
- else {
- g_debug ("The card change succeeded with the new xfconf card %s.\n", Inst->xfconf_card_name);
- }
-
- g_free (previous_card);
-
- // If an xfconf track has failed to be applied before, it's probably that the user chosed his new track before the card to which it belongs.
- // So we check if the track belongs to our new card.
- if (Inst->previously_set_track_label) {
- xvd_get_track_from_mixer (Inst, Inst->previously_set_track_label, Inst->track_label);
- if (g_strcmp0 (Inst->previously_set_track_label, Inst->track_label) == 0) {
- xvd_xfconf_set_track (Inst, Inst->previously_set_track_label);
- g_free (Inst->previously_set_track_label);
- g_debug ("The previously set xfconf track was a track from the newly set sound card.\n");
- }
- }
- // Else, we can still try to see if the current track applies
- else {
- xvd_get_track_from_mixer (Inst, Inst->track_label, NULL);
- }
-
- xvd_mixer_init_volume (Inst);
-
- g_debug ("Xfconf reinit: the card is now %s, the track is %s and the volume is %d\n", Inst->card_name, Inst->track_label, Inst->current_vol);
-}
-
-static void
-_xvd_xfconf_reinit_track(XvdInstance *Inst)
-{
- gchar *previous_track = NULL;
-
- if (!xvd_xfconf_get_track (Inst)) {
- // If we fail to get an xfconf track, we save the current one in xfconf
- if (Inst->track_label != NULL) {
- xvd_xfconf_set_track (Inst, Inst->track_label);
- Inst->xfconf_track_label = g_strdup (Inst->track_label);
- }
- // If the current track is NULL too, we do nothing
- return;
- }
-
- // If the track set in xfconf is the same as the currently used one, we do nothing
- if ((Inst->track_label != NULL) && (g_strcmp0 (Inst->xfconf_track_label, Inst->track_label) == 0)) {
- return;
- }
-
- // We now try to replace it with the one set in xfconf
- previous_track = g_strdup (Inst->track_label);
- xvd_get_track_from_mixer (Inst, Inst->xfconf_track_label, previous_track);
-
- // We check if the track has been correctly set
- if ((Inst->track_label == NULL) || (g_strcmp0 (Inst->xfconf_track_label, Inst->track_label) != 0)) {
- // If not, we save the valid track in xfconf instead of the user chosen
- Inst->previously_set_track_label = g_strdup (Inst->xfconf_track_label);
- g_debug ("The track chosen in xfconf (%s) doesn't exist in the current card. It'll be tried again after a sound card change.\nNow using %s.\n",
- Inst->xfconf_track_label,
- Inst->track_label);
- xvd_xfconf_set_track (Inst, Inst->track_label);
- g_free (Inst->xfconf_track_label);
- Inst->xfconf_track_label = g_strdup (Inst->track_label);
- }
- else {
- g_free (Inst->previously_set_track_label);
- }
-
- xvd_mixer_init_volume (Inst);
- g_free (previous_track);
-
- g_debug ("Xfconf reinit: the track is now %s and the volume is %d\n", Inst->track_label, Inst->current_vol);
-}
static void
@@ -145,14 +36,7 @@ _xvd_xfconf_handle_changes(XfconfChannel *re_channel,
XvdInstance *Inst = (XvdInstance *)ptr;
g_debug ("Xfconf event on %s\n", re_property_name);
- if (g_strcmp0 (re_property_name, XFCONF_MIXER_ACTIVECARD) == 0) {
- _xvd_xfconf_reinit_card(Inst);
- }
- else if (g_strcmp0 (re_property_name, XFCONF_MIXER_ACTIVETRACK) == 0) {
- _xvd_xfconf_reinit_track(Inst);
- _xvd_xfconf_reinit_vol_step(Inst);
- }
- else if (g_strcmp0 (re_property_name, XFCONF_MIXER_VOL_STEP) == 0) {
+ if (g_strcmp0 (re_property_name, XFCONF_MIXER_VOL_STEP) == 0) {
_xvd_xfconf_reinit_vol_step(Inst);
}
}
@@ -170,66 +54,6 @@ xvd_xfconf_init(XvdInstance *Inst)
g_signal_connect (G_OBJECT (Inst->chan), "property-changed", G_CALLBACK (_xvd_xfconf_handle_changes), Inst);
}
-gboolean
-xvd_xfconf_get_card(XvdInstance *Inst)
-{
- if (Inst->xfconf_card_name) {
- g_debug ("%s\n", "Cleaning the current card name stored in xfconf");
- g_free (Inst->xfconf_card_name);
- }
-
- if (FALSE == xfconf_channel_has_property (Inst->chan, XFCONF_MIXER_ACTIVECARD)) {
- // Transition purpose - we dont watch changes on the legacy property afterwards
- if (FALSE == xfconf_channel_has_property (Inst->chan, XFCONF_MIXER_ACTIVECARD_LEGACY)) {
- g_debug ("%s\n", "There is no card name stored in xfconf");
- return FALSE;
- }
- else {
- g_debug ("%s\n", "Using the legacy xfconf property for the card name, and saving its value into the new xfconf property");
- Inst->xfconf_card_name = xfconf_channel_get_string (Inst->chan, XFCONF_MIXER_ACTIVECARD_LEGACY, NULL);
- xvd_xfconf_set_card (Inst, Inst->xfconf_card_name);
- g_debug ("%s %s\n", "Xfconf card name:", Inst->xfconf_card_name);
- return Inst->xfconf_card_name != NULL;
- }
- }
-
- Inst->xfconf_card_name = xfconf_channel_get_string (Inst->chan, XFCONF_MIXER_ACTIVECARD, NULL);
- return Inst->xfconf_card_name != NULL;
-}
-
-void
-xvd_xfconf_set_card(XvdInstance *Inst, gchar *value)
-{
- g_debug ("%s %s\n", "Setting the xfconf card name to", value);
- xfconf_channel_set_string (Inst->chan, XFCONF_MIXER_ACTIVECARD, value);
-}
-
-gboolean
-xvd_xfconf_get_track(XvdInstance *Inst)
-{
- if (Inst->xfconf_track_label) {
- g_debug ("%s\n", "Cleaning the current track label stored in xfconf");
- g_free (Inst->xfconf_track_label);
- }
-
- Inst->xfconf_track_label = xfconf_channel_get_string (Inst->chan, XFCONF_MIXER_ACTIVETRACK, NULL);
- if (Inst->xfconf_track_label != NULL) {
- g_debug ("%s %s\n", "Xfconf track label:", Inst->xfconf_track_label);
- return TRUE;
- }
- else {
- g_debug ("%s\n", "There is no track label stored in xfconf");
- return FALSE;
- }
-}
-
-void
-xvd_xfconf_set_track(XvdInstance *Inst, gchar *value)
-{
- g_debug("%s %s\n", "Setting the xfconf card name to", value);
- xfconf_channel_set_string (Inst->chan, XFCONF_MIXER_ACTIVETRACK, value);
-}
-
void
xvd_xfconf_get_vol_step(XvdInstance *Inst)
{
diff --git a/src/xvd_xfconf.h b/src/xvd_xfconf.h
index e68bba3..0e5e188 100644
--- a/src/xvd_xfconf.h
+++ b/src/xvd_xfconf.h
@@ -27,18 +27,6 @@
void
xvd_xfconf_init(XvdInstance *Inst);
-gboolean
-xvd_xfconf_get_card(XvdInstance *Inst);
-
-void
-xvd_xfconf_set_card(XvdInstance *Inst, gchar *value);
-
-gboolean
-xvd_xfconf_get_track(XvdInstance *Inst);
-
-void
-xvd_xfconf_set_track(XvdInstance *Inst, gchar *value);
-
void
xvd_xfconf_get_vol_step(XvdInstance *Inst);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list