[Xfce4-commits] <parole:master> Remove broken seekf/seekb from dbus/cli commands. Improve mute dbus/cli command. Add unmute dbus/cli command
Sean Davis
noreply at xfce.org
Fri Oct 11 11:52:36 CEST 2013
Updating branch refs/heads/master
to 4f8e3ca6f9b55823e3fcca8f8241b87de4694c21 (commit)
from 38ac3e19be4efa57157e15f588bf10665a0a7704 (commit)
commit 4f8e3ca6f9b55823e3fcca8f8241b87de4694c21
Author: Sean Davis <smd.seandavis at gmail.com>
Date: Sun Sep 22 07:57:18 2013 -0400
Remove broken seekf/seekb from dbus/cli commands. Improve mute dbus/cli command. Add unmute dbus/cli command
src/main.c | 18 ++++++---------
src/org.parole.media.player.xml | 9 +++-----
src/parole-player.c | 46 +++++++++++++++++++--------------------
3 files changed, 32 insertions(+), 41 deletions(-)
diff --git a/src/main.c b/src/main.c
index 6917c80..b2abf32 100644
--- a/src/main.c
+++ b/src/main.c
@@ -260,11 +260,10 @@ int main (int argc, char **argv)
gboolean stop = FALSE;
gboolean next_track = FALSE;
gboolean prev_track = FALSE;
- gboolean seek_f = FALSE;
- gboolean seek_b = FALSE;
gboolean raise_volume = FALSE;
gboolean lower_volume = FALSE;
gboolean mute = FALSE;
+ gboolean unmute = FALSE;
gboolean no_plugins = FALSE;
gboolean embedded = FALSE;
gboolean fullscreen = FALSE;
@@ -281,11 +280,10 @@ int main (int argc, char **argv)
{ "stop", 's', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &stop, N_("Stop playing"), NULL },
{ "next-track", 'N', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &next_track, N_("Next track"), NULL },
{ "previous-track", 'P', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &prev_track, N_("Previous track"), NULL },
- { "seek-f", 'f', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &seek_f, N_("Seek forward"), NULL },
- { "seek-b", 'b', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &seek_b, N_("Seek Backward"), NULL },
{ "raise-volume", 'r', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &raise_volume, N_("Raise volume"), NULL },
{ "lower-volume", 'l', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &lower_volume, N_("Lower volume"), NULL },
{ "mute", 'm', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &mute, N_("Mute volume"), NULL },
+ { "unmute", 'u', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &unmute, N_("Unmute (restore) volume"), NULL },
{ "version", 'V', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &version, N_("Print version information and exit"), NULL },
{ "embedded", 'E', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &embedded, N_("Start in embedded mode"), NULL },
{ "fullscreen", 'F', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &fullscreen, N_("Start in fullscreen mode"), NULL },
@@ -340,7 +338,8 @@ int main (int argc, char **argv)
/* Check for cli options if there is an instance of Parole already */
if ( !new_instance && parole_dbus_name_has_owner (PAROLE_DBUS_NAME) )
{
- if (!enqueue)
+ if (!enqueue && !play && !stop && !next_track && !prev_track &&
+ !raise_volume && !lower_volume && !mute && !unmute)
g_print (_("Parole is already running, use -i to open a new instance\n"));
if ( filenames && filenames[0] != NULL )
@@ -360,12 +359,6 @@ int main (int argc, char **argv)
if ( prev_track )
parole_send_message ("PrevTrack");
- if ( seek_f )
- parole_send_message ("SeekForward");
-
- if ( seek_b )
- parole_send_message ("SeekBackward");
-
if ( raise_volume )
parole_send_message ("RaiseVolume");
@@ -374,6 +367,9 @@ int main (int argc, char **argv)
if ( mute )
parole_send_message ("Mute");
+
+ if ( unmute )
+ parole_send_message ("Unmute");
}
/* Create a new instance because Parole isn't running */
diff --git a/src/org.parole.media.player.xml b/src/org.parole.media.player.xml
index 5be1362..d53987f 100644
--- a/src/org.parole.media.player.xml
+++ b/src/org.parole.media.player.xml
@@ -19,12 +19,6 @@
<method name="PrevTrack">
</method>
- <method name="SeekForward">
- </method>
-
- <method name="SeekBackward">
- </method>
-
<method name="RaiseVolume">
</method>
@@ -34,6 +28,9 @@
<method name="Mute">
</method>
+ <method name="Unmute">
+ </method>
+
<method name="PlayDisc">
<arg type="s" name="uri" direction="in"/>
<arg type="s" name="device" direction="in"/>
diff --git a/src/parole-player.c b/src/parole-player.c
index d43ef04..cabf6f9 100644
--- a/src/parole-player.c
+++ b/src/parole-player.c
@@ -397,6 +397,7 @@ struct ParolePlayerPrivate
GtkWidget *audiobox_artist;
GtkWidget *volume;
+ GtkWidget *mute;
GtkWidget *menu_bar;
GtkWidget *save_playlist;
GtkWidget *play_box;
@@ -2259,12 +2260,12 @@ void parole_player_volume_mute (GtkWidget *widget, ParolePlayer *player)
g_object_get (G_OBJECT (player->priv->conf),
"volume", &value,
NULL);
- gtk_menu_item_set_label( GTK_MENU_ITEM(widget), _("Mute") );
+ gtk_menu_item_set_label( GTK_MENU_ITEM(player->priv->mute), _("Mute") );
}
else
{
value = 0;
- gtk_menu_item_set_label( GTK_MENU_ITEM(widget), _("Unmute") );
+ gtk_menu_item_set_label( GTK_MENU_ITEM(player->priv->mute), _("Unmute") );
}
gtk_scale_button_set_value (GTK_SCALE_BUTTON (player->priv->volume), (gdouble)(value)/100);
}
@@ -3205,6 +3206,7 @@ parole_player_init (ParolePlayer *player)
/* Volume Button */
player->priv->volume = GTK_WIDGET (gtk_builder_get_object (builder, "media_volumebutton"));
+ player->priv->mute = GTK_WIDGET (gtk_builder_get_object (builder, "volume-mute-menu"));
/* (un)Fullscreen button */
player->priv->fullscreen_button = GTK_WIDGET (gtk_builder_get_object (builder, "media_fullscreen"));
@@ -3539,12 +3541,6 @@ static gboolean parole_player_dbus_next_track (ParolePlayer *player,
static gboolean parole_player_dbus_prev_track (ParolePlayer *player,
GError *error);
-static gboolean parole_player_dbus_seek_forward (ParolePlayer *player,
- GError *error);
-
-static gboolean parole_player_dbus_seek_backward (ParolePlayer *player,
- GError *error);
-
static gboolean parole_player_dbus_raise_volume (ParolePlayer *player,
GError *error);
@@ -3553,6 +3549,9 @@ static gboolean parole_player_dbus_lower_volume (ParolePlayer *player,
static gboolean parole_player_dbus_mute (ParolePlayer *player,
GError *error);
+
+static gboolean parole_player_dbus_unmute (ParolePlayer *player,
+ GError *error);
static gboolean parole_player_dbus_play_disc (ParolePlayer *player,
gchar *in_uri,
@@ -3606,21 +3605,7 @@ static gboolean parole_player_dbus_prev_track (ParolePlayer *player,
parole_player_play_prev (player);
return TRUE;
}
-
-static gboolean parole_player_dbus_seek_forward (ParolePlayer *player,
- GError *error)
-{
- parole_player_play_next (player, TRUE);
- return TRUE;
-}
-
-static gboolean parole_player_dbus_seek_backward (ParolePlayer *player,
- GError *error)
-{
- parole_player_play_prev (player);
- return TRUE;
-}
-
+
static gboolean parole_player_dbus_raise_volume (ParolePlayer *player,
GError *error)
{
@@ -3638,7 +3623,20 @@ static gboolean parole_player_dbus_lower_volume (ParolePlayer *player,
static gboolean parole_player_dbus_mute (ParolePlayer *player,
GError *error)
{
- gtk_scale_button_set_value (GTK_SCALE_BUTTON (player->priv->volume), 0);
+ if (!gtk_scale_button_get_value (GTK_SCALE_BUTTON (player->priv->volume)) == 0.0)
+ {
+ parole_player_volume_mute(NULL, player);
+ }
+ return TRUE;
+}
+
+static gboolean parole_player_dbus_unmute (ParolePlayer *player,
+ GError *error)
+{
+ if (gtk_scale_button_get_value (GTK_SCALE_BUTTON (player->priv->volume)) == 0.0)
+ {
+ parole_player_volume_mute(NULL, player);
+ }
return TRUE;
}
More information about the Xfce4-commits
mailing list