[Xfce4-commits] <parole:master> Addition of separate disc playlist.

Sean Davis noreply at xfce.org
Sat Dec 15 13:56:01 CET 2012


Updating branch refs/heads/master
         to 659c33a107e677d3efa5b37594c5a659b57cf25d (commit)
       from bb72d99afbac675c2508046405a3fbba7f2d5626 (commit)

commit 659c33a107e677d3efa5b37594c5a659b57cf25d
Author: Sean Davis <smd.seandavis at gmail.com>
Date:   Sat Dec 15 07:54:58 2012 -0500

    Addition of separate disc playlist.

 data/interfaces/playlist.ui |  171 ++++++++++++++++++++++++++------------
 src/parole-disc.c           |   10 --
 src/parole-medialist.c      |  195 +++++++++++++++++++++++++++++++------------
 src/parole-medialist.h      |   11 ++-
 src/parole-player.c         |   21 +----
 5 files changed, 272 insertions(+), 136 deletions(-)

diff --git a/data/interfaces/playlist.ui b/data/interfaces/playlist.ui
index 4f2ff08..1330b86 100644
--- a/data/interfaces/playlist.ui
+++ b/data/interfaces/playlist.ui
@@ -92,21 +92,101 @@
     <property name="visible">True</property>
     <property name="can_focus">False</property>
     <child>
-      <object class="GtkToggleButton" id="dvd_menu_button">
+      <object class="GtkNotebook" id="playlist_notebook">
+        <property name="visible">True</property>
         <property name="can_focus">True</property>
-        <property name="receives_default">True</property>
-        <property name="no_show_all">True</property>
-        <property name="use_action_appearance">False</property>
+        <property name="tab_pos">bottom</property>
+        <property name="show_tabs">False</property>
+        <property name="show_border">False</property>
+        <child>
+          <object class="GtkScrolledWindow" id="scrolledwindow1">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="hscrollbar_policy">never</property>
+            <property name="vscrollbar_policy">automatic</property>
+            <property name="window_placement_set">True</property>
+            <property name="shadow_type">in</property>
+            <child>
+              <object class="GtkTreeView" id="media-list">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="headers_visible">False</property>
+                <property name="rules_hint">True</property>
+                <signal name="drag-data-received" handler="parole_media_list_drag_data_received_cb" swapped="no"/>
+                <signal name="key-press-event" handler="parole_media_list_key_press" swapped="no"/>
+                <signal name="row-activated" handler="parole_media_list_row_activated_cb" swapped="no"/>
+                <signal name="button-release-event" handler="parole_media_list_button_release_event" swapped="no"/>
+                <signal name="query-tooltip" handler="parole_media_list_query_tooltip" swapped="no"/>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child type="tab">
+          <object class="GtkLabel" id="label1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">Playlist</property>
+          </object>
+          <packing>
+            <property name="tab_fill">False</property>
+          </packing>
+        </child>
         <child>
-          <object class="GtkHBox" id="hbox1">
+          <object class="GtkVBox" id="vbox1">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="spacing">3</property>
             <child>
-              <object class="GtkImage" id="image_disc">
+              <object class="GtkToggleButton" id="dvd_menu_button">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="icon_name">drive-optical</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_action_appearance">False</property>
+                <child>
+                  <object class="GtkHBox" id="hbox1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="spacing">3</property>
+                    <child>
+                      <object class="GtkImage" id="image_disc">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="icon_name">drive-optical</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="dvd_label">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">DVD Name</property>
+                        <property name="ellipsize">end</property>
+                      </object>
+                      <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkArrow" id="arrow1">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="arrow_type">down</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="pack_type">end</property>
+                        <property name="position">2</property>
+                      </packing>
+                    </child>
+                  </object>
+                </child>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -115,12 +195,22 @@
               </packing>
             </child>
             <child>
-              <object class="GtkLabel" id="dvd_label">
+              <object class="GtkScrolledWindow" id="scrolledwindow2">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="xalign">0</property>
-                <property name="label" translatable="yes">DVD Name</property>
-                <property name="ellipsize">end</property>
+                <property name="can_focus">True</property>
+                <property name="hscrollbar_policy">never</property>
+                <property name="vscrollbar_policy">automatic</property>
+                <property name="window_placement_set">True</property>
+                <property name="shadow_type">in</property>
+                <child>
+                  <object class="GtkTreeView" id="disc-list">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="headers_visible">False</property>
+                    <property name="rules_hint">True</property>
+                    <signal name="row-activated" handler="parole_media_list_row_activated_cb" swapped="no"/>
+                  </object>
+                </child>
               </object>
               <packing>
                 <property name="expand">True</property>
@@ -128,54 +218,27 @@
                 <property name="position">1</property>
               </packing>
             </child>
-            <child>
-              <object class="GtkArrow" id="arrow1">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="arrow_type">down</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="pack_type">end</property>
-                <property name="position">2</property>
-              </packing>
-            </child>
           </object>
+          <packing>
+            <property name="position">1</property>
+          </packing>
         </child>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">True</property>
-        <property name="position">0</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkScrolledWindow" id="scrolledwindow1">
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="hscrollbar_policy">never</property>
-        <property name="vscrollbar_policy">automatic</property>
-        <property name="window_placement_set">True</property>
-        <property name="shadow_type">in</property>
-        <child>
-          <object class="GtkTreeView" id="media-list">
+        <child type="tab">
+          <object class="GtkLabel" id="label2">
             <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="headers_visible">False</property>
-            <property name="rules_hint">True</property>
-            <signal name="drag-data-received" handler="parole_media_list_drag_data_received_cb" swapped="no"/>
-            <signal name="key-press-event" handler="parole_media_list_key_press" swapped="no"/>
-            <signal name="row-activated" handler="parole_media_list_row_activated_cb" swapped="no"/>
-            <signal name="button-release-event" handler="parole_media_list_button_release_event" swapped="no"/>
-            <signal name="query-tooltip" handler="parole_media_list_query_tooltip" swapped="no"/>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">Disc Playlist</property>
           </object>
+          <packing>
+            <property name="position">1</property>
+            <property name="tab_fill">False</property>
+          </packing>
         </child>
       </object>
       <packing>
         <property name="expand">True</property>
         <property name="fill">True</property>
-        <property name="position">1</property>
+        <property name="position">0</property>
       </packing>
     </child>
     <child>
@@ -286,7 +349,7 @@
         <property name="expand">False</property>
         <property name="fill">False</property>
         <property name="padding">2</property>
-        <property name="position">2</property>
+        <property name="position">1</property>
       </packing>
     </child>
   </object>
diff --git a/src/parole-disc.c b/src/parole-disc.c
index ce22e83..cd0303e 100644
--- a/src/parole-disc.c
+++ b/src/parole-disc.c
@@ -62,7 +62,6 @@ struct ParoleDiscPrivate
 enum
 {
     DISC_SELECTED,
-    DVD_ENABLED,
     LABEL_CHANGED,
     LAST_SIGNAL
 };
@@ -525,15 +524,6 @@ parole_disc_class_init (ParoleDiscClass *klass)
 		      _gmarshal_VOID__STRING_STRING,
                       G_TYPE_NONE, 2, 
 		      G_TYPE_STRING, G_TYPE_STRING);
-		      
-    signals[DVD_ENABLED] = 
-        g_signal_new ("dvd-enabled",
-                      PAROLE_TYPE_DISC,
-                      G_SIGNAL_RUN_LAST,
-                      G_STRUCT_OFFSET (ParoleDiscClass, dvd_enabled),
-                      NULL, NULL,
-                      g_cclosure_marshal_VOID__BOOLEAN,
-                      G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
 
     signals[LABEL_CHANGED] = 
         g_signal_new ("label-changed",
diff --git a/src/parole-medialist.c b/src/parole-medialist.c
index a310b56..ac38bf9 100644
--- a/src/parole-medialist.c
+++ b/src/parole-medialist.c
@@ -93,7 +93,7 @@ static GtkTreeRowReference *
 						   GtkTreeIter *iter, 
 						   gboolean select_path);
 
-static void 	parole_media_list_select_path 	  (ParoleMediaList *list, 
+static void 	parole_media_list_select_path 	  (ParoleMediaList *list, gboolean disc,
 						   GtkTreePath *path);
 
 /*
@@ -181,15 +181,20 @@ struct ParoleMediaListPrivate
 {
     DBusGConnection     *bus;
     ParoleConf          *conf;
-    GtkWidget 	  	*view;
-    GtkWidget		*box;
-    GtkListStore	*store;
+    GtkWidget 	  	    *view;
+    GtkWidget           *disc_view;
+    GtkWidget		    *box;
+    GtkListStore	    *store;
+    GtkListStore	    *disc_store;
     GtkTreeSelection    *sel;
+    GtkTreeSelection    *disc_sel;
     
     GtkWidget *dvd_menu;
     GtkWidget *dvd_menu_button;
     GtkWidget *dvd_label;
     GtkWidget *playlist_controls;
+    
+    GtkWidget *playlist_notebook;
 
     GtkWidget *remove_button;
     GtkWidget *clear_button;
@@ -234,6 +239,7 @@ parole_media_list_set_widget_sensitive (ParoleMediaList *list, gboolean sensitiv
  * parole_media_list_add:
  * @ParoleMediaList: a #ParoleMediaList
  * @file: a #ParoleFile
+ * @disc: TRUE if added to disc playlist.
  * @emit: TRUE to emit a play signal.
  * @select_row: TRUE to select the added row
  * 
@@ -242,7 +248,7 @@ parole_media_list_set_widget_sensitive (ParoleMediaList *list, gboolean sensitiv
  * start playing the added file.
  **/
 static void
-parole_media_list_add (ParoleMediaList *list, ParoleFile *file, gboolean emit, gboolean select_row)
+parole_media_list_add (ParoleMediaList *list, ParoleFile *file, gboolean disc, gboolean emit, gboolean select_row)
 {
     GtkListStore *list_store;
     GtkTreePath *path;
@@ -250,7 +256,10 @@ parole_media_list_add (ParoleMediaList *list, ParoleFile *file, gboolean emit, g
     GtkTreeIter iter;
     gint nch;
     
-    list_store = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (list->priv->view)));
+    if (disc)
+        list_store = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (list->priv->disc_view)));
+    else
+        list_store = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (list->priv->view)));
     
     gtk_list_store_append (list_store, &iter);
     
@@ -267,7 +276,7 @@ parole_media_list_add (ParoleMediaList *list, ParoleFile *file, gboolean emit, g
 	path = gtk_tree_model_get_path (GTK_TREE_MODEL (list_store), &iter);
 	row = gtk_tree_row_reference_new (GTK_TREE_MODEL (list_store), path);
 	if ( select_row )
-	    parole_media_list_select_path (list, path);
+	    parole_media_list_select_path (list, disc, path);
 	gtk_tree_path_free (path);
 	if ( emit )
 	    g_signal_emit (G_OBJECT (list), signals [MEDIA_ACTIVATED], 0, row);
@@ -280,6 +289,9 @@ parole_media_list_add (ParoleMediaList *list, ParoleFile *file, gboolean emit, g
      */
     g_object_unref (file);
     
+    if (disc)
+    nch = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (list->priv->disc_store), NULL); 
+    else
     nch = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (list->priv->store), NULL); 
     
     if ( nch == 1 )
@@ -296,11 +308,12 @@ parole_media_list_add (ParoleMediaList *list, ParoleFile *file, gboolean emit, g
  * parole_media_list_files_open:
  * @ParoleMediaList: a #ParoleMediaList
  * @files: a #GSList contains a list of #ParoleFile
+ * @disc: TRUE if files are opened to the disc playlist.
  * @emit: TRUE to emit a play signal.
  * 
  **/
 static void
-parole_media_list_files_open (ParoleMediaList *list, GSList *files, gboolean emit)
+parole_media_list_files_open (ParoleMediaList *list, GSList *files, gboolean disc, gboolean emit)
 {
     ParoleFile *file;
     gboolean replace;
@@ -322,13 +335,13 @@ parole_media_list_files_open (ParoleMediaList *list, GSList *files, gboolean emi
 	if ( replace )
 	    parole_media_list_clear_list (list);
 	file = g_slist_nth_data (files, 0);
-	parole_media_list_add (list, file, emit, TRUE);
+	parole_media_list_add (list, file, disc, emit, TRUE);
     }
     
     for ( i = 1; i < len; i++)
     {
 	file = g_slist_nth_data (files, i);
-	parole_media_list_add (list, file, FALSE, FALSE);
+	parole_media_list_add (list, file, disc, FALSE, FALSE);
     }
 }
 
@@ -345,7 +358,7 @@ parole_media_list_add_cdda_tracks (ParoleMediaList *list, gint n_tracks)
         files = g_slist_append(files, file);
     }
     
-    parole_media_list_files_open(list, files, TRUE);
+    parole_media_list_files_open(list, files, FALSE, TRUE);
 }
 
 void
@@ -362,7 +375,7 @@ parole_media_list_add_dvd_chapters (ParoleMediaList *list, gint n_chapters)
     }
     
     //parole_media_list_clear_list (list);
-    parole_media_list_files_open(list, files, TRUE);
+    parole_media_list_files_open(list, files, TRUE, TRUE);
 }
 
 /* Callback to determine whether opened files should start playing immediately */
@@ -377,7 +390,7 @@ parole_media_list_files_opened_cb (ParoleMediaChooser *chooser,
 		  "play-opened-files", &play,
 		  NULL);
     
-    parole_media_list_files_open (list, files, play);
+    parole_media_list_files_open (list, files, FALSE, play);
 }
 
 static void
@@ -392,7 +405,7 @@ parole_media_list_location_opened_cb (ParoleOpenLocation *obj, const gchar *loca
     else
     {
 	file = parole_file_new (location);
-	parole_media_list_add (list, file, TRUE, TRUE);
+	parole_media_list_add (list, file, FALSE, TRUE, TRUE);
     }
 }
 
@@ -910,7 +923,7 @@ parole_media_list_remove_clicked_cb (GtkButton *button, ParoleMediaList *list)
 	
 	if ( gtk_tree_path_prev (prev) )
 	{
-	    parole_media_list_select_path (list, prev);
+	    parole_media_list_select_path (list, FALSE, prev);
 	    row_selected = TRUE;
 	}
 	gtk_tree_path_free (prev);
@@ -943,7 +956,7 @@ parole_media_list_remove_clicked_cb (GtkButton *button, ParoleMediaList *list)
     {
 	GtkTreePath *path;
 	path = parole_media_list_get_first_path (model);
-	parole_media_list_select_path (list, path);
+	parole_media_list_select_path (list, FALSE, path);
 	gtk_tree_path_free (path);
     }
     
@@ -976,8 +989,12 @@ parole_media_list_row_activated_cb (GtkTreeView *view, GtkTreePath *path,
 {
     GtkTreeRowReference *row;
     
+    if (gtk_notebook_get_current_page(GTK_NOTEBOOK(list->priv->playlist_notebook)) == 0)
     row = gtk_tree_row_reference_new (gtk_tree_view_get_model (GTK_TREE_VIEW (list->priv->view)), 
 				      path);
+    else
+    row = gtk_tree_row_reference_new (gtk_tree_view_get_model (GTK_TREE_VIEW (list->priv->disc_view)), 
+				      path);
 				      
     g_signal_emit (G_OBJECT (list), signals [MEDIA_ACTIVATED], 0, row);
 }
@@ -1072,6 +1089,18 @@ parole_media_list_add_open_containing_folder (ParoleMediaList *list, GtkWidget *
     }
 }
 
+void
+parole_media_list_set_playlist_view(ParoleMediaList *list, gint view)
+{
+    gtk_notebook_set_current_page(GTK_NOTEBOOK(list->priv->playlist_notebook), view);
+}
+
+void
+parole_media_list_clear_disc_list (ParoleMediaList *list)
+{
+    gtk_list_store_clear (GTK_LIST_STORE (list->priv->disc_store));
+    //parole_media_list_set_widget_sensitive (list, FALSE);
+}
 
 void
 parole_media_list_clear_list (ParoleMediaList *list)
@@ -1168,14 +1197,6 @@ menu_detach( GtkMenu *menu )
 }
 
 void
-parole_media_list_set_dvd_menu_visible(ParoleMediaList *list, gboolean visible)
-{
-    gtk_widget_set_visible(list->priv->dvd_menu_button, visible);
-    /* Disable the playlist controls when in DVD mode. */
-    gtk_widget_set_sensitive(list->priv->playlist_controls, !visible);
-}
-
-void
 parole_media_list_add_dvd (ParoleMediaList *list, gchar *dvd_name)
 {
     //parole_media_list_set_dvd_menu_visible(list, TRUE);
@@ -1435,10 +1456,18 @@ parole_media_list_button_release_event (GtkWidget *widget, GdkEventButton *ev, P
 }
 
 static void
-parole_media_list_select_path (ParoleMediaList *list, GtkTreePath *path)
+parole_media_list_select_path (ParoleMediaList *list, gboolean disc, GtkTreePath *path)
 {
+    if (disc)
+    {
+    gtk_tree_selection_select_path (list->priv->disc_sel, path);
+    gtk_tree_view_set_cursor (GTK_TREE_VIEW (list->priv->disc_view), path, NULL, FALSE);
+    }
+    else
+    {
     gtk_tree_selection_select_path (list->priv->sel, path);
     gtk_tree_view_set_cursor (GTK_TREE_VIEW (list->priv->view), path, NULL, FALSE);
+    }
 }
 
 static GtkTreeRowReference *
@@ -1451,7 +1480,7 @@ parole_media_list_get_row_reference_from_iter (ParoleMediaList *list, GtkTreeIte
     row = gtk_tree_row_reference_new (GTK_TREE_MODEL (list->priv->store), path);
     
     if ( select_path)
-	parole_media_list_select_path (list, path);
+	parole_media_list_select_path (list, FALSE, path);
     
     gtk_tree_path_free (path);
     
@@ -1548,60 +1577,80 @@ parole_media_list_class_init (ParoleMediaListClass *klass)
 static void
 parole_media_list_setup_view (ParoleMediaList *list)
 {
-    GtkTreeSelection *sel;
-    GtkListStore *list_store;
-    GtkTreeViewColumn *col;
-    GtkCellRenderer *renderer;
+    GtkTreeSelection *sel, *disc_sel;
+    GtkListStore *list_store, *disc_list_store;
+    GtkTreeViewColumn *col, *disc_col;
+    GtkCellRenderer *renderer, *disc_renderer;
 
     list_store = gtk_list_store_new (COL_NUMBERS, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_OBJECT);
+    disc_list_store = gtk_list_store_new (COL_NUMBERS, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_OBJECT);
 
     gtk_tree_view_set_model (GTK_TREE_VIEW (list->priv->view), GTK_TREE_MODEL(list_store));
+    gtk_tree_view_set_model (GTK_TREE_VIEW (list->priv->disc_view), GTK_TREE_MODEL(disc_list_store));
     
     gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (list->priv->view), TRUE);
+    gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (list->priv->disc_view), TRUE);
     col = gtk_tree_view_column_new ();
+    disc_col = gtk_tree_view_column_new ();
 
     renderer = gtk_cell_renderer_pixbuf_new ();
+    disc_renderer = gtk_cell_renderer_pixbuf_new ();
     
     gtk_tree_view_column_pack_start(col, renderer, FALSE);
+    gtk_tree_view_column_pack_start(disc_col, disc_renderer, FALSE);
     gtk_tree_view_column_set_attributes(col, renderer, "pixbuf", PIXBUF_COL, NULL);
-
+    gtk_tree_view_column_set_attributes(disc_col, disc_renderer, "pixbuf", PIXBUF_COL, NULL);
 
     /**
      * Name col
      * 
      **/
     renderer = gtk_cell_renderer_text_new();
+    disc_renderer = gtk_cell_renderer_text_new();
     
     gtk_tree_view_column_pack_start (col, renderer, TRUE);
     gtk_tree_view_column_set_attributes (col, renderer, "text", NAME_COL, NULL);
     g_object_set (renderer, 
 		  "ellipsize", PANGO_ELLIPSIZE_END, 
 		  NULL);
-    
+		  
+    gtk_tree_view_column_pack_start (disc_col, disc_renderer, TRUE);
+    gtk_tree_view_column_set_attributes (disc_col, disc_renderer, "text", NAME_COL, NULL);
+    g_object_set (disc_renderer, 
+		  "ellipsize", PANGO_ELLIPSIZE_END, 
+		  NULL);
     
     /**
      * Media length
      * 
      **/
     renderer = gtk_cell_renderer_text_new();
+    disc_renderer = gtk_cell_renderer_text_new();
     
     gtk_tree_view_column_pack_start (col, renderer, FALSE);
+    gtk_tree_view_column_pack_start (disc_col, disc_renderer, FALSE);
     gtk_tree_view_column_set_attributes (col, renderer, "text", LENGTH_COL, NULL);
-    
+    gtk_tree_view_column_set_attributes (disc_col, disc_renderer, "text", LENGTH_COL, NULL);
     
     gtk_tree_view_append_column (GTK_TREE_VIEW (list->priv->view), col);
+    gtk_tree_view_append_column (GTK_TREE_VIEW (list->priv->disc_view), disc_col);
     gtk_tree_view_column_set_title (col, _("Media list"));
+    gtk_tree_view_column_set_title (disc_col, _("Chapter list"));
 
     gtk_drag_dest_set (list->priv->view, GTK_DEST_DEFAULT_ALL, target_entry, G_N_ELEMENTS (target_entry),
                        GDK_ACTION_COPY | GDK_ACTION_MOVE);
     
     list->priv->sel = sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (list->priv->view));
+    list->priv->disc_sel = disc_sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (list->priv->disc_view));
     gtk_tree_selection_set_mode (sel, GTK_SELECTION_MULTIPLE);
     
     g_signal_connect (sel, "changed",
 		      G_CALLBACK (parole_media_list_selection_changed_cb), list);
+    g_signal_connect (disc_sel, "changed",
+		      G_CALLBACK (parole_media_list_selection_changed_cb), list);
     
     list->priv->store = list_store;
+    list->priv->disc_store = disc_list_store;
 }
 
 static void
@@ -1622,11 +1671,13 @@ parole_media_list_init (ParoleMediaList *list)
     list->priv->dvd_menu = GTK_WIDGET (gtk_builder_get_object(builder, "dvd-menu"));
     list->priv->dvd_label = GTK_WIDGET (gtk_builder_get_object(builder, "dvd_label"));
     list->priv->playlist_controls = GTK_WIDGET (gtk_builder_get_object(builder, "playlist_controls"));
+    list->priv->playlist_notebook = GTK_WIDGET (gtk_builder_get_object(builder, "playlist_notebook"));
     
     g_signal_connect (GTK_TOGGLE_BUTTON(list->priv->dvd_menu_button), "toggled",
 		      G_CALLBACK (parole_media_list_show_dvd_menu), list);
     
     list->priv->view = GTK_WIDGET (gtk_builder_get_object (builder, "media-list"));
+    list->priv->disc_view = GTK_WIDGET (gtk_builder_get_object (builder, "disc-list"));
     
     box = GTK_WIDGET (gtk_builder_get_object (builder, "playlist-box"));
     
@@ -1694,7 +1745,7 @@ void parole_media_list_load (ParoleMediaList *list)
 	    fileslist = parole_pl_parser_parse_from_file_by_extension (playlist_file);
 	    g_free (playlist_file);
 	    
-	    parole_media_list_files_open (list, fileslist, play);
+	    parole_media_list_files_open (list, fileslist, FALSE, play);
 	    g_slist_free (fileslist);
 	}
     }
@@ -1716,7 +1767,7 @@ parole_media_list_add_by_path (ParoleMediaList *list, const gchar *path, gboolea
     
     parole_get_media_files (filter, path, TRUE, &files_list);
     
-    parole_media_list_files_open (list, files_list, emit);
+    parole_media_list_files_open (list, files_list, FALSE, emit);
     
     len = g_slist_length (files_list);
     ret = len == 0 ? FALSE : TRUE;
@@ -1802,10 +1853,15 @@ GtkTreeRowReference *parole_media_list_get_row_n (ParoleMediaList *list,
         
     path = gtk_tree_path_new_from_string( g_strdup_printf("%i", wanted_row) );
 
-    if ( gtk_tree_model_get_iter (GTK_TREE_MODEL (list->priv->store), &iter, path))
+    if (gtk_notebook_get_current_page(GTK_NOTEBOOK(list->priv->playlist_notebook)) == 0)
     {
-	row = gtk_tree_row_reference_new (GTK_TREE_MODEL (list->priv->store), path);
-	//parole_media_list_select_path (list, path);
+        if ( gtk_tree_model_get_iter (GTK_TREE_MODEL (list->priv->store), &iter, path))
+        	row = gtk_tree_row_reference_new (GTK_TREE_MODEL (list->priv->store), path);
+    }
+    else
+    {
+        if ( gtk_tree_model_get_iter (GTK_TREE_MODEL (list->priv->disc_store), &iter, path))
+        	row = gtk_tree_row_reference_new (GTK_TREE_MODEL (list->priv->disc_store), path);
     }
     
     gtk_tree_path_free (path);
@@ -1848,15 +1904,21 @@ GtkTreeRowReference *parole_media_list_get_row_random (ParoleMediaList *list)
 }
 
 gboolean parole_media_list_is_selected_row  (ParoleMediaList *list)
-{
+{   
+    if (gtk_notebook_get_current_page(GTK_NOTEBOOK(list->priv->playlist_notebook)) == 0)
     return gtk_tree_selection_count_selected_rows (list->priv->sel) > 0;
+    else
+    return gtk_tree_selection_count_selected_rows (list->priv->disc_sel) > 0;
 }
 
 gboolean parole_media_list_is_empty (ParoleMediaList *list)
 {
     GtkTreeIter iter;
     
+    if (gtk_notebook_get_current_page(GTK_NOTEBOOK(list->priv->playlist_notebook)) == 0)
     return !gtk_tree_model_get_iter_first (GTK_TREE_MODEL (list->priv->store), &iter);
+    else
+    return !gtk_tree_model_get_iter_first (GTK_TREE_MODEL (list->priv->disc_store), &iter);
 }
 
 /**
@@ -1871,9 +1933,15 @@ GtkTreeRowReference *parole_media_list_get_first_row (ParoleMediaList *list)
     GtkTreeRowReference *row = NULL;
     GtkTreeIter iter;
     
-    if ( gtk_tree_model_get_iter_first (GTK_TREE_MODEL (list->priv->store), &iter) )
+    if (gtk_notebook_get_current_page(GTK_NOTEBOOK(list->priv->playlist_notebook)) == 0)
     {
-	row = parole_media_list_get_row_reference_from_iter (list, &iter, TRUE);
+        if ( gtk_tree_model_get_iter_first (GTK_TREE_MODEL (list->priv->store), &iter) )
+	        row = parole_media_list_get_row_reference_from_iter (list, &iter, TRUE);
+    }
+    else
+    {
+        if ( gtk_tree_model_get_iter_first (GTK_TREE_MODEL (list->priv->disc_store), &iter) )
+    	    row = parole_media_list_get_row_reference_from_iter (list, &iter, TRUE);
     }
     
     return row;
@@ -1909,9 +1977,11 @@ void parole_media_list_select_row (ParoleMediaList *list, GtkTreeRowReference *r
     
     if ( gtk_tree_row_reference_valid (row) )
     {
-	path = gtk_tree_row_reference_get_path (row);
-	parole_media_list_select_path (list, path);
-	gtk_tree_path_free (path);
+	    path = gtk_tree_row_reference_get_path (row);
+	    parole_media_list_select_path (list, 
+	        gtk_notebook_get_current_page(GTK_NOTEBOOK(list->priv->playlist_notebook)) == 1, 
+	        path);
+	    gtk_tree_path_free (path);
     }
 }
 
@@ -1924,10 +1994,17 @@ void parole_media_list_set_row_pixbuf  (ParoleMediaList *list, GtkTreeRowReferen
     {
 	path = gtk_tree_row_reference_get_path (row);
 	
-	if ( gtk_tree_model_get_iter (GTK_TREE_MODEL (list->priv->store), &iter, path) )
+	if (gtk_notebook_get_current_page(GTK_NOTEBOOK(list->priv->playlist_notebook)) == 0)
+	{
+	    if ( gtk_tree_model_get_iter (GTK_TREE_MODEL (list->priv->store), &iter, path) )
+	        gtk_list_store_set (list->priv->store, &iter, PIXBUF_COL, pix, -1);
+	}
+	else
 	{
-	    gtk_list_store_set (list->priv->store, &iter, PIXBUF_COL, pix, -1);
+	    if ( gtk_tree_model_get_iter (GTK_TREE_MODEL (list->priv->disc_store), &iter, path) )
+	        gtk_list_store_set (list->priv->disc_store, &iter, PIXBUF_COL, pix, -1);
 	}
+
 	gtk_tree_path_free (path);
     }
 }
@@ -1941,10 +2018,17 @@ void parole_media_list_set_row_name (ParoleMediaList *list, GtkTreeRowReference
     {
 	path = gtk_tree_row_reference_get_path (row);
 	
-	if ( gtk_tree_model_get_iter (GTK_TREE_MODEL (list->priv->store), &iter, path) )
+	if (gtk_notebook_get_current_page(GTK_NOTEBOOK(list->priv->playlist_notebook)) == 0)
 	{
-	    gtk_list_store_set (list->priv->store, &iter, NAME_COL, name, -1);
+    	if ( gtk_tree_model_get_iter (GTK_TREE_MODEL (list->priv->store), &iter, path) )
+    	    gtk_list_store_set (list->priv->store, &iter, NAME_COL, name, -1);
 	}
+	else
+	{
+    	if ( gtk_tree_model_get_iter (GTK_TREE_MODEL (list->priv->disc_store), &iter, path) )
+    	    gtk_list_store_set (list->priv->disc_store, &iter, NAME_COL, name, -1);
+	}
+	
 	gtk_tree_path_free (path);
     }
 }
@@ -1958,10 +2042,17 @@ void parole_media_list_set_row_length (ParoleMediaList *list, GtkTreeRowReferenc
     {
 	path = gtk_tree_row_reference_get_path (row);
 	
-	if ( gtk_tree_model_get_iter (GTK_TREE_MODEL (list->priv->store), &iter, path) )
+	if (gtk_notebook_get_current_page(GTK_NOTEBOOK(list->priv->playlist_notebook)) == 0)
+	{
+	    if ( gtk_tree_model_get_iter (GTK_TREE_MODEL (list->priv->store), &iter, path) )
+    	    gtk_list_store_set (list->priv->store, &iter, LENGTH_COL, len, -1);
+	}
+	else
 	{
-	    gtk_list_store_set (list->priv->store, &iter, LENGTH_COL, len, -1);
+    	if ( gtk_tree_model_get_iter (GTK_TREE_MODEL (list->priv->disc_store), &iter, path) )
+    	    gtk_list_store_set (list->priv->disc_store, &iter, LENGTH_COL, len, -1);
 	}
+	
 	gtk_tree_path_free (path);
     }
 }
@@ -1996,9 +2087,9 @@ gboolean parole_media_list_add_files (ParoleMediaList *list, gchar **filenames,
 	    TRACE ("File=%s", filenames[i]);
 	    file = parole_file_new (filenames[i]);
 		if (enqueue) {
-			parole_media_list_add (list, file, FALSE, FALSE);}
+			parole_media_list_add (list, file, FALSE, FALSE, FALSE);}
 		else
-			parole_media_list_add (list, file, i == 0 ? TRUE : FALSE, i == 0 ? TRUE : FALSE);
+			parole_media_list_add (list, file, FALSE, i == 0 ? TRUE : FALSE, i == 0 ? TRUE : FALSE);
 	    added++;
 	}
     }
diff --git a/src/parole-medialist.h b/src/parole-medialist.h
index c880fa7..95721dd 100644
--- a/src/parole-medialist.h
+++ b/src/parole-medialist.h
@@ -39,6 +39,12 @@ enum
     COL_NUMBERS
 };
 
+enum
+{
+    PAROLE_MEDIA_LIST_PLAYLIST_VIEW_STANDARD,
+    PAROLE_MEDIA_LIST_PLAYLIST_VIEW_DISC
+};
+
 typedef struct ParoleMediaListPrivate ParoleMediaListPrivate;
 
 typedef struct
@@ -82,6 +88,9 @@ GtkWidget       		*parole_media_list_get              (void);
 
 void				 parole_media_list_load             (ParoleMediaList *list);
 
+void    parole_media_list_set_playlist_view(ParoleMediaList *list, gint view);
+
+void    parole_media_list_clear_disc_list (ParoleMediaList *list);
 
 void	parole_media_list_clear_list 	  (ParoleMediaList *list);
 
@@ -151,8 +160,6 @@ void 				 parole_media_list_set_shuffle_toggled		(ParoleMediaList *list,
 																
 void parole_media_list_add_dvd (ParoleMediaList *list, gchar *dvd_name);
 
-							
-void parole_media_list_set_dvd_menu_visible(ParoleMediaList *list, gboolean visible);
 
 G_END_DECLS
 
diff --git a/src/parole-player.c b/src/parole-player.c
index 584c949..0faa362 100644
--- a/src/parole-player.c
+++ b/src/parole-player.c
@@ -578,7 +578,8 @@ parole_player_reset (ParolePlayer *player)
 	player->priv->row = NULL;
     }
     
-    parole_media_list_set_dvd_menu_visible(player->priv->list, FALSE);
+    parole_media_list_set_playlist_view(player->priv->list, PAROLE_MEDIA_LIST_PLAYLIST_VIEW_STANDARD);
+    //parole_media_list_clear_disc_list (player->priv->list);
 }
 
 static void
@@ -1037,17 +1038,10 @@ parole_player_disc_selected_cb (ParoleDisc *disc, const gchar *uri, const gchar
     player->priv->current_media_type = parole_gst_get_current_stream_type (PAROLE_GST (player->priv->gst));
     
     if ( player->priv->current_media_type == PAROLE_MEDIA_TYPE_CDDA )
-    {
         player->priv->wait_for_gst_disc_info = TRUE;
-        parole_media_list_set_dvd_menu_visible(player->priv->list, FALSE);
-    }
-    else if (player->priv->current_media_type == PAROLE_MEDIA_TYPE_DVD )
-        parole_media_list_set_dvd_menu_visible(player->priv->list, TRUE);
-    else
-        parole_media_list_set_dvd_menu_visible(player->priv->list, FALSE);
-        
     
     parole_media_list_clear_list (player->priv->list);
+    parole_media_list_set_playlist_view(player->priv->list, PAROLE_MEDIA_LIST_PLAYLIST_VIEW_DISC);
 }
 
 static void
@@ -1057,12 +1051,6 @@ parole_player_disc_label_changed_cb (ParoleDisc *disc, const gchar *label, Parol
 }
 
 static void
-parole_player_disc_dvd_enabled_cb (ParoleDisc *disc, gboolean enabled, ParolePlayer *player)
-{
-    parole_media_list_set_dvd_menu_visible(player->priv->list, enabled);
-}
-
-static void
 parole_player_uri_opened_cb (ParoleMediaList *list, const gchar *uri, ParolePlayer *player)
 {
     parole_player_reset (player);
@@ -2777,9 +2765,6 @@ parole_player_init (ParolePlayer *player)
 		      
     g_signal_connect (player->priv->disc, "label-changed",
 		      G_CALLBACK (parole_player_disc_label_changed_cb), player);
-		      
-    g_signal_connect (player->priv->disc, "dvd-enabled",
-		      G_CALLBACK (parole_player_disc_dvd_enabled_cb), player);
 	    
     player->priv->screen_saver = parole_screen_saver_new ();
     player->priv->list = PAROLE_MEDIA_LIST (parole_media_list_get ());


More information about the Xfce4-commits mailing list