Commits

Damián Nohales committed cb45c9d

Support for multiple selection at download list.

  • Participants
  • Parent commits 3cf2d6a

Comments (0)

Files changed (3)

File data/main_window.ui

         <property name="use_action_appearance">False</property>
         <property name="use_underline">True</property>
         <property name="use_stock">True</property>
-        <signal name="activate" handler="on_stop_download" swapped="no"/>
+        <signal name="activate" handler="on_pause_download" swapped="no"/>
       </object>
     </child>
     <child>

File lib/DownloadList.py

             pass
         
     def create_view(self):
+        self.get_view().get_selection().set_mode(gtk.SELECTION_MULTIPLE)
+        
         column = gtk.TreeViewColumn("", gtk.CellRendererPixbuf(), stock_id = 5)
         column.set_resizable(False)
         self.get_view().append_column(column)

File lib/SharkDown.py

             
             if path != None:
                 selection = treeview.get_selection()
-                rows = selection.get_selected_rows()
-                selection.unselect_all()
-                selection.select_path(path[0])
+                selected_rows = self.downloads.get_selected_rows()
                 
-                song = self.downloads.get_song(path[0])
-                if song.get_state() == Song.STATE_PAUSED:
-                    self.downmenu.get_children()[0].hide()
-                    self.downmenu.get_children()[1].show()
-                else:
-                    self.downmenu.get_children()[1].hide()
-                    self.downmenu.get_children()[0].show()
+                if not (path[0] in selected_rows):
+                    selection.unselect_all()
+                    selection.select_path(path[0])
+                
+                selected_rows = self.downloads.get_selected_rows()
+                self.downmenu.get_children()[0].set_sensitive(False)
+                self.downmenu.get_children()[1].set_sensitive(False)
+                for path in selected_rows:
+                    if self.downloads.get_song(path).get_state() == Song.STATE_PAUSED:
+                        self.downmenu.get_children()[1].set_sensitive(True)
+                    else:
+                        self.downmenu.get_children()[0].set_sensitive(True)
                     
                 self.downmenu.popup(None, None, None, event.button, event.time)
+                
+                return True
 
     def on_cancel_all_downloads(self, widget, data = None):
         """
         """
         select = self.downloads.get_selected_rows()
         for path in select:
-            song = self.downloads.get_song(path).cancel_download()
+            #song = self.downloads.get_song(path).cancel_download()
+            print path
 
-    def on_stop_download(self, button, data = None):
+    def on_pause_download(self, button, data = None):
         """
         TODO: Not yet implemented, have to see how the download
         list will be saved.