[Xfce4-commits] [panel-plugins/xfce4-pulseaudio-plugin] 03/08: Make the default mixer command a compile-time option
noreply at xfce.org
noreply at xfce.org
Tue Mar 3 23:45:58 CET 2015
This is an automated email from the git hooks/post-receive script.
andrzejr pushed a commit to branch master
in repository panel-plugins/xfce4-pulseaudio-plugin.
commit 0352549fba7cd068f45e84ca86b0cdb52f7d4056
Author: Guido Berhoerster <guido+xfce at berhoerster.name>
Date: Tue Mar 3 20:01:34 2015 +0100
Make the default mixer command a compile-time option
Make the default mixer command a compile-time option and rename mixer
name to mixer command since it is interpreted a command which can be
optionally specified with full path and command line options.
---
configure.ac.in | 16 ++++++++++++---
panel-plugin/Makefile.am | 1 +
panel-plugin/pulseaudio-config.c | 36 ++++++++++++++++------------------
panel-plugin/pulseaudio-config.h | 2 +-
panel-plugin/pulseaudio-dialog.c | 20 +++++++++----------
panel-plugin/pulseaudio-dialog.glade | 2 +-
panel-plugin/pulseaudio-plugin.c | 2 +-
7 files changed, 44 insertions(+), 35 deletions(-)
diff --git a/configure.ac.in b/configure.ac.in
index 3923de4..53a6baf 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -105,6 +105,15 @@ dnl *** Check for debugging support ***
dnl ***********************************
XDT_FEATURE_DEBUG()
+dnl *****************************
+dnl *** Default mixer command ***
+dnl *****************************
+AC_ARG_WITH([mixer-command],
+ [AS_HELP_STRING([--with-mixer-command=CMD], [Default mixer command (default: pavucontrol]))],
+ [DEFAULT_MIXER_COMMAND="$withval"],
+ [DEFAULT_MIXER_COMMAND="pavucontrol"])
+AC_SUBST([DEFAULT_MIXER_COMMAND])
+
dnl *********************************
dnl *** Substitute platform flags ***
dnl *********************************
@@ -134,7 +143,8 @@ dnl ***************************
echo
echo "Build Configuration:"
echo
-echo "* Debug Support: $enable_debug"
-echo "* Use keybinder: ${KEYBINDER_FOUND:-no}"
-echo "* Use IDO library: ${IDO_FOUND:-no}"
+echo "* Debug Support: $enable_debug"
+echo "* Use keybinder: ${KEYBINDER_FOUND:-no}"
+echo "* Use IDO library: ${IDO_FOUND:-no}"
+echo "* Default Mixer command: $DEFAULT_MIXER_COMMAND"
echo
diff --git a/panel-plugin/Makefile.am b/panel-plugin/Makefile.am
index 907c9c9..8f0fa21 100644
--- a/panel-plugin/Makefile.am
+++ b/panel-plugin/Makefile.am
@@ -3,6 +3,7 @@ INCLUDES = \
-I$(top_srcdir) \
-DG_LOG_DOMAIN=\"pulseaudio-plugin\" \
-DPACKAGE_LOCALE_DIR=\"$(localedir)\" \
+ -DDEFAULT_MIXER_COMMAND=\"$(DEFAULT_MIXER_COMMAND)\" \
$(PLATFORM_CPPFLAGS)
#
diff --git a/panel-plugin/pulseaudio-config.c b/panel-plugin/pulseaudio-config.c
index a3b9703..cb8aa13 100644
--- a/panel-plugin/pulseaudio-config.c
+++ b/panel-plugin/pulseaudio-config.c
@@ -47,8 +47,6 @@
#define DEFAULT_ENABLE_KEYBOARD_SHORTCUTS TRUE
#define DEFAULT_VOLUME_STEP 6
-#define DEFAULT_MIXER_NAME "pavucontrol"
-
@@ -75,7 +73,7 @@ struct _PulseaudioConfig
gboolean enable_keyboard_shortcuts;
guint volume_step;
- gchar *mixer_name;
+ gchar *mixer_command;
};
@@ -85,7 +83,7 @@ enum
PROP_0,
PROP_ENABLE_KEYBOARD_SHORTCUTS,
PROP_VOLUME_STEP,
- PROP_MIXER_NAME,
+ PROP_MIXER_COMMAND,
N_PROPERTIES,
};
@@ -131,10 +129,10 @@ pulseaudio_config_class_init (PulseaudioConfigClass *klass)
g_object_class_install_property (gobject_class,
- PROP_MIXER_NAME,
- g_param_spec_string ("mixer-name",
+ PROP_MIXER_COMMAND,
+ g_param_spec_string ("mixer-command",
NULL, NULL,
- DEFAULT_MIXER_NAME,
+ DEFAULT_MIXER_COMMAND,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
@@ -155,7 +153,7 @@ pulseaudio_config_init (PulseaudioConfig *config)
{
config->enable_keyboard_shortcuts = DEFAULT_ENABLE_KEYBOARD_SHORTCUTS;
config->volume_step = DEFAULT_VOLUME_STEP;
- config->mixer_name = g_strdup (DEFAULT_MIXER_NAME);
+ config->mixer_command = g_strdup (DEFAULT_MIXER_COMMAND);
}
@@ -166,7 +164,7 @@ pulseaudio_config_finalize (GObject *object)
PulseaudioConfig *config = PULSEAUDIO_CONFIG (object);
xfconf_shutdown();
- g_free (config->mixer_name);
+ g_free (config->mixer_command);
G_OBJECT_CLASS (pulseaudio_config_parent_class)->finalize (object);
}
@@ -191,8 +189,8 @@ pulseaudio_config_get_property (GObject *object,
g_value_set_uint (value, config->volume_step);
break;
- case PROP_MIXER_NAME:
- g_value_set_string (value, config->mixer_name);
+ case PROP_MIXER_COMMAND:
+ g_value_set_string (value, config->mixer_command);
break;
default:
@@ -235,9 +233,9 @@ pulseaudio_config_set_property (GObject *object,
}
break;
- case PROP_MIXER_NAME:
- g_free (config->mixer_name);
- config->mixer_name = g_value_dup_string (value);
+ case PROP_MIXER_COMMAND:
+ g_free (config->mixer_command);
+ config->mixer_command = g_value_dup_string (value);
break;
default:
@@ -272,11 +270,11 @@ pulseaudio_config_get_volume_step (PulseaudioConfig *config)
const gchar *
-pulseaudio_config_get_mixer_name (PulseaudioConfig *config)
+pulseaudio_config_get_mixer_command (PulseaudioConfig *config)
{
- g_return_val_if_fail (IS_PULSEAUDIO_CONFIG (config), DEFAULT_MIXER_NAME);
+ g_return_val_if_fail (IS_PULSEAUDIO_CONFIG (config), DEFAULT_MIXER_COMMAND);
- return config->mixer_name;
+ return config->mixer_command;
}
@@ -303,8 +301,8 @@ pulseaudio_config_new (const gchar *property_base)
xfconf_g_property_bind (channel, property, G_TYPE_UINT, config, "volume-step");
g_free (property);
- property = g_strconcat (property_base, "/mixer-name", NULL);
- xfconf_g_property_bind (channel, property, G_TYPE_STRING, config, "mixer-name");
+ property = g_strconcat (property_base, "/mixer-command", NULL);
+ xfconf_g_property_bind (channel, property, G_TYPE_STRING, config, "mixer-command");
g_free (property);
g_object_notify (G_OBJECT (config), "enable-keyboard-shortcuts");
diff --git a/panel-plugin/pulseaudio-config.h b/panel-plugin/pulseaudio-config.h
index 4a6b385..22abaa3 100644
--- a/panel-plugin/pulseaudio-config.h
+++ b/panel-plugin/pulseaudio-config.h
@@ -40,7 +40,7 @@ PulseaudioConfig *pulseaudio_config_new (const gchar
gboolean pulseaudio_config_get_enable_keyboard_shortcuts (PulseaudioConfig *config);
guint pulseaudio_config_get_volume_step (PulseaudioConfig *config);
-const gchar *pulseaudio_config_get_mixer_name (PulseaudioConfig *config);
+const gchar *pulseaudio_config_get_mixer_command (PulseaudioConfig *config);
G_END_DECLS
diff --git a/panel-plugin/pulseaudio-dialog.c b/panel-plugin/pulseaudio-dialog.c
index 0e43e2b..6da227e 100644
--- a/panel-plugin/pulseaudio-dialog.c
+++ b/panel-plugin/pulseaudio-dialog.c
@@ -56,7 +56,7 @@
static void pulseaudio_dialog_build (PulseaudioDialog *dialog);
static void pulseaudio_dialog_help_button_clicked (PulseaudioDialog *dialog,
GtkWidget *button);
-static void pulseaudio_dialog_mixer_name_changed (PulseaudioDialog *dialog);
+static void pulseaudio_dialog_mixer_command_changed (PulseaudioDialog *dialog);
static void pulseaudio_dialog_run_mixer (PulseaudioDialog *dialog,
GtkWidget *widget);
@@ -98,7 +98,7 @@ pulseaudio_dialog_init (PulseaudioDialog *dialog)
static void
-pulseaudio_dialog_mixer_name_changed (PulseaudioDialog *dialog)
+pulseaudio_dialog_mixer_command_changed (PulseaudioDialog *dialog)
{
GObject *object;
gchar *path;
@@ -108,7 +108,7 @@ pulseaudio_dialog_mixer_name_changed (PulseaudioDialog *dialog)
object = gtk_builder_get_object (GTK_BUILDER (dialog), "button-run-mixer");
g_return_if_fail (GTK_IS_BUTTON (object));
- path = g_find_program_in_path (pulseaudio_config_get_mixer_name (dialog->config));
+ path = g_find_program_in_path (pulseaudio_config_get_mixer_command (dialog->config));
gtk_widget_set_sensitive (GTK_WIDGET (object), path != NULL);
g_free (path);
}
@@ -125,11 +125,11 @@ pulseaudio_dialog_run_mixer (PulseaudioDialog *dialog,
g_return_if_fail (GTK_IS_BUTTON (widget));
if (!xfce_spawn_command_line_on_screen (gtk_widget_get_screen (widget),
- pulseaudio_config_get_mixer_name (dialog->config),
+ pulseaudio_config_get_mixer_command (dialog->config),
FALSE, FALSE, &error))
{
xfce_dialog_show_error (NULL, error, _("Failed to execute command \"%s\"."),
- pulseaudio_config_get_mixer_name (dialog->config));
+ pulseaudio_config_get_mixer_command (dialog->config));
g_error_free (error);
}
}
@@ -171,18 +171,18 @@ pulseaudio_dialog_build (PulseaudioDialog *dialog)
G_OBJECT (object), "active",
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
- object = gtk_builder_get_object (builder, "entry-mixer-name");
+ object = gtk_builder_get_object (builder, "entry-mixer-command");
g_return_if_fail (GTK_IS_ENTRY (object));
- g_object_bind_property (G_OBJECT (dialog->config), "mixer-name",
+ g_object_bind_property (G_OBJECT (dialog->config), "mixer-command",
G_OBJECT (object), "text",
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
object = gtk_builder_get_object (builder, "button-run-mixer");
g_return_if_fail (GTK_IS_BUTTON (object));
- g_signal_connect_swapped (G_OBJECT (dialog->config), "notify::mixer-name",
- G_CALLBACK (pulseaudio_dialog_mixer_name_changed),
+ g_signal_connect_swapped (G_OBJECT (dialog->config), "notify::mixer-command",
+ G_CALLBACK (pulseaudio_dialog_mixer_command_changed),
dialog);
- pulseaudio_dialog_mixer_name_changed (dialog);
+ pulseaudio_dialog_mixer_command_changed (dialog);
g_signal_connect_swapped (G_OBJECT (object), "clicked",
G_CALLBACK (pulseaudio_dialog_run_mixer), dialog);
diff --git a/panel-plugin/pulseaudio-dialog.glade b/panel-plugin/pulseaudio-dialog.glade
index 9f0030e..44858c3 100644
--- a/panel-plugin/pulseaudio-dialog.glade
+++ b/panel-plugin/pulseaudio-dialog.glade
@@ -160,7 +160,7 @@
</packing>
</child>
<child>
- <object class="GtkEntry" id="entry-mixer-name">
+ <object class="GtkEntry" id="entry-mixer-command">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Audio mixer command that can be executed from the context menu, e.g. "pavucontrol", "unity-control-center sound".</property>
diff --git a/panel-plugin/pulseaudio-plugin.c b/panel-plugin/pulseaudio-plugin.c
index 0f22cc4..9d07c77 100644
--- a/panel-plugin/pulseaudio-plugin.c
+++ b/panel-plugin/pulseaudio-plugin.c
@@ -322,7 +322,7 @@ pulseaudio_plugin_mixer_item_activate_cb (PulseaudioPlugin *pulseaudio_plugin,
g_return_if_fail (IS_PULSEAUDIO_PLUGIN (pulseaudio_plugin));
- command = pulseaudio_config_get_mixer_name (pulseaudio_plugin->config);
+ command = pulseaudio_config_get_mixer_command (pulseaudio_plugin->config);
if (!xfce_spawn_command_line_on_screen (gtk_widget_get_screen (GTK_WIDGET (menu_item)),
command, FALSE, FALSE, &error))
{
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list