[Xfce4-commits] <parole:ochosi/audiobox> Minimal patch to show an "audiobox" with meta-information from tags when audio is playing

Simon Steinbeiss noreply at xfce.org
Thu Nov 22 13:50:02 CET 2012


Updating branch refs/heads/ochosi/audiobox
         to 7ce80b05c3015620f70efcef8cee0dabfababd09 (commit)
       from fb7a48cd3fc3dbc34797dc3002881a3a85acd672 (commit)

commit 7ce80b05c3015620f70efcef8cee0dabfababd09
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Thu Nov 22 13:48:40 2012 +0100

    Minimal patch to show an "audiobox" with meta-information from tags when audio is playing

 data/interfaces/parole.ui |   37 ++++++++++++++++++++++++++++++++++++-
 src/parole-player.c       |   26 ++++++++++++++++++++++++++
 2 files changed, 62 insertions(+), 1 deletions(-)

diff --git a/data/interfaces/parole.ui b/data/interfaces/parole.ui
index 9327849..4bd0e08 100644
--- a/data/interfaces/parole.ui
+++ b/data/interfaces/parole.ui
@@ -684,6 +684,41 @@
                                   </packing>
                                 </child>
                                 <child>
+                                  <object class="GtkVBox" id="audiobox">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <child>
+                                      <object class="GtkImage" id="cover">
+                                        <property name="can_focus">False</property>
+                                        <property name="pixel_size">128</property>
+                                        <property name="icon_name">audio-x-generic</property>
+                                      </object>
+                                      <packing>
+                                        <property name="expand">True</property>
+                                        <property name="fill">True</property>
+                                        <property name="position">0</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <object class="GtkLabel" id="audiotags">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                        <property name="label" translatable="yes">label</property>
+                                      </object>
+                                      <packing>
+                                        <property name="expand">True</property>
+                                        <property name="fill">True</property>
+                                        <property name="position">1</property>
+                                      </packing>
+                                    </child>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">True</property>
+                                    <property name="fill">True</property>
+                                    <property name="position">2</property>
+                                  </packing>
+                                </child>
+                                <child>
                                   <object class="GtkVBox" id="control">
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
@@ -938,7 +973,7 @@ audio-volume-medium</property>
                                   <packing>
                                     <property name="expand">False</property>
                                     <property name="fill">True</property>
-                                    <property name="position">2</property>
+                                    <property name="position">3</property>
                                   </packing>
                                 </child>
                               </object>
diff --git a/src/parole-player.c b/src/parole-player.c
index 3cfbeb8..a013f24 100644
--- a/src/parole-player.c
+++ b/src/parole-player.c
@@ -339,6 +339,10 @@ struct ParolePlayerPrivate
     GtkWidget		*languages_menu;
     
     GtkWidget		*main_box;
+    GtkWidget		*eventbox_output;
+    GtkWidget		*audiobox;
+    GtkWidget		*cover;
+    GtkWidget		*audiotags;
     
     GtkWidget		*volume;
     GtkWidget		*menu_bar;
@@ -817,6 +821,22 @@ parole_player_update_languages (ParolePlayer *player, ParoleGst *gst)
 	}
 }
 
+static void
+parole_player_show_audiobox (ParolePlayer *player)
+{
+    /* Only show the audiobox if we're sure there's no video playing */
+    if (!gst_get_has_video( PAROLE_GST(player->priv->gst) ))
+    {
+	gtk_widget_show_all(player->priv->audiobox);
+	gtk_widget_hide_all(player->priv->eventbox_output);
+    }
+    else
+    {
+	gtk_widget_hide_all(player->priv->audiobox);
+	gtk_widget_show_all(player->priv->eventbox_output);
+    }
+}
+
 /**
  * parole_player_select_custom_subtitle:
  * @widget : The #GtkMenuItem for selecting a custom subtitle file.
@@ -951,6 +971,7 @@ parole_player_media_activated_cb (ParoleMediaList *list, GtkTreeRowReference *ro
 	    TRACE ("Trying to play media file %s", uri);
 	    TRACE ("File content type %s", parole_file_get_content_type (file));
 	    
+	    
 	    parole_gst_play_uri (PAROLE_GST (player->priv->gst), 
 				 parole_file_get_uri (file),
 				 sub);
@@ -1364,6 +1385,7 @@ parole_player_media_state_cb (ParoleGst *gst, const ParoleStream *stream, Parole
     if ( state == PAROLE_STATE_PLAYING )
     {
 	parole_player_playing (player, stream);
+	parole_player_show_audiobox(player);
     }
     else if ( state == PAROLE_STATE_PAUSED )
     {
@@ -2607,6 +2629,10 @@ parole_player_init (ParolePlayer *player)
     player->priv->go_fs = GTK_WIDGET (gtk_builder_get_object (builder, "go_fs"));
     player->priv->leave_fs = GTK_WIDGET (gtk_builder_get_object (builder, "leave_fs"));
     player->priv->main_box = GTK_WIDGET (gtk_builder_get_object (builder, "main-box"));
+    player->priv->eventbox_output = GTK_WIDGET (gtk_builder_get_object (builder, "eventbox_output"));
+    player->priv->audiobox = GTK_WIDGET (gtk_builder_get_object (builder, "audiobox"));
+    player->priv->cover = GTK_WIDGET (gtk_builder_get_object (builder, "cover"));
+    player->priv->audiotags = GTK_WIDGET (gtk_builder_get_object (builder, "audiotags"));
     
     gtk_box_set_child_packing( GTK_BOX(player->priv->control), GTK_WIDGET(player->priv->play_box), TRUE, TRUE, 2, GTK_PACK_START );
     


More information about the Xfce4-commits mailing list