summaryrefslogtreecommitdiff
path: root/gst-mixer/src/preferences.c
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2012-11-08 00:33:57 +0100
committerStefano Karapetsas <[email protected]>2012-11-08 00:33:57 +0100
commit4e46fd01ff3c5d1c9a6400a0533d36d4bc56dfb2 (patch)
treedbcf12ee51edaf93d861a905ea2e81b7a8f88210 /gst-mixer/src/preferences.c
parente7268ae0d2429f9f8895ac4ff5087cc83f7f00e5 (diff)
downloadmate-media-4e46fd01ff3c5d1c9a6400a0533d36d4bc56dfb2.tar.bz2
mate-media-4e46fd01ff3c5d1c9a6400a0533d36d4bc56dfb2.tar.xz
gst-mixer: allow to hide whitelist elementsmate-media-1.5.0
Diffstat (limited to 'gst-mixer/src/preferences.c')
-rw-r--r--gst-mixer/src/preferences.c42
1 files changed, 27 insertions, 15 deletions
diff --git a/gst-mixer/src/preferences.c b/gst-mixer/src/preferences.c
index bc93af1..55dd6ad 100644
--- a/gst-mixer/src/preferences.c
+++ b/gst-mixer/src/preferences.c
@@ -52,7 +52,7 @@ static void mate_volume_control_preferences_response (GtkDialog *dialog,
gint response_id);
static void set_gsettings_track_active (GSettings *settings, GstMixer *mixer,
- GstMixerTrack *track, gboolean active);
+ GstMixerTrack *track, gboolean active, gboolean is_whitelist);
static void cb_toggle (GtkCellRendererToggle *cell,
@@ -327,7 +327,7 @@ mate_volume_control_preferences_change (MateVolumeControlPreferences *prefs,
static void
set_gsettings_track_active(GSettings *settings, GstMixer *mixer,
- GstMixerTrack *track, gboolean active)
+ GstMixerTrack *track, gboolean active, gboolean is_whitelist)
{
gchar *name;
@@ -335,14 +335,31 @@ set_gsettings_track_active(GSettings *settings, GstMixer *mixer,
if (active == TRUE)
{
+ if (is_whitelist == TRUE)
+ {
+ schemas_gsettings_remove_all_from_strv (settings, MATE_VOLUME_CONTROL_KEY_HIDDEN_ELEMENTS, name);
+ }
+ else
+ {
if (schemas_is_str_in_strv (settings, MATE_VOLUME_CONTROL_KEY_SHOWN_ELEMENTS, name) == FALSE)
{
schemas_gsettings_append_strv (settings, MATE_VOLUME_CONTROL_KEY_SHOWN_ELEMENTS, name);
}
+ }
}
else
{
- schemas_gsettings_remove_all_from_strv (settings, MATE_VOLUME_CONTROL_KEY_SHOWN_ELEMENTS, name);
+ if (is_whitelist == TRUE)
+ {
+ if (schemas_is_str_in_strv (settings, MATE_VOLUME_CONTROL_KEY_HIDDEN_ELEMENTS, name) == FALSE)
+ {
+ schemas_gsettings_append_strv (settings, MATE_VOLUME_CONTROL_KEY_HIDDEN_ELEMENTS, name);
+ }
+ }
+ else
+ {
+ schemas_gsettings_remove_all_from_strv (settings, MATE_VOLUME_CONTROL_KEY_SHOWN_ELEMENTS, name);
+ }
}
g_free (name);
@@ -395,13 +412,10 @@ cb_activated(GtkTreeView *view, GtkTreePath *path,
is_whitelist = mate_volume_control_element_whitelist (prefs->mixer, track);
- if (is_whitelist == FALSE)
- {
- active = !active;
+ active = !active;
- gtk_list_store_set( GTK_LIST_STORE(model), &iter, COL_ACTIVE, active, -1);
- set_gsettings_track_active(prefs->settings, prefs->mixer, track, active);
- }
+ gtk_list_store_set( GTK_LIST_STORE(model), &iter, COL_ACTIVE, active, -1);
+ set_gsettings_track_active(prefs->settings, prefs->mixer, track, active, is_whitelist);
}
}
@@ -426,14 +440,12 @@ cb_toggle (GtkCellRendererToggle *cell,
mate_volume_control_element_whitelist (prefs->mixer, NULL);
is_whitelist = mate_volume_control_element_whitelist (prefs->mixer, track);
- if (is_whitelist == FALSE)
- {
- active = !active;
+ active = !active;
- gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter,
COL_ACTIVE, active,
-1);
- set_gsettings_track_active(prefs->settings, prefs->mixer, track, active);
- }
+ set_gsettings_track_active(prefs->settings, prefs->mixer, track, active, is_whitelist);
+
gtk_tree_path_free (path);
}