Commits

Vladimir Kolev committed 7320e93

load_saved_playlist modified to be reused
Added to new buttons "Save playlist" and "Open saved playlist" to deal with different playlist
Added tooltips to buttons

Comments (0)

Files changed (2)

data/main_window.ui

-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <requires lib="gtk+" version="2.18"/>
   <!-- interface-naming-policy project-wide -->
+  <object class="GtkImage" id="image1">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="pixel_size">25</property>
+    <property name="icon_name">audio-volume-high</property>
+  </object>
+  <object class="GtkImage" id="image10">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="stock">gtk-open</property>
+  </object>
+  <object class="GtkImage" id="image2">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="stock">gtk-add</property>
+  </object>
+  <object class="GtkImage" id="image3">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="stock">gtk-delete</property>
+  </object>
+  <object class="GtkImage" id="image4">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="icon_name">media-playlist-repeat</property>
+  </object>
+  <object class="GtkImage" id="image5">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="icon_name">media-playlist-shuffle</property>
+  </object>
+  <object class="GtkImage" id="image8">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="stock">gtk-clear</property>
+  </object>
+  <object class="GtkImage" id="image9">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="stock">gtk-save-as</property>
+  </object>
   <object class="GtkWindow" id="window1">
+    <property name="can_focus">False</property>
     <property name="title" translatable="yes">gSharkDown</property>
     <property name="window_position">center-always</property>
     <property name="default_width">700</property>
     <child>
       <object class="GtkVBox" id="vbox1">
         <property name="visible">True</property>
+        <property name="can_focus">False</property>
         <child>
           <object class="GtkToolbar" id="toolbar1">
             <property name="visible">True</property>
+            <property name="can_focus">False</property>
             <property name="toolbar_style">icons</property>
             <property name="icon_size_set">True</property>
             <child>
               <object class="GtkToolItem" id="toolbutton1">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="use_action_appearance">False</property>
                 <child>
                   <object class="GtkEntry" id="entry1">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="tooltip_text" translatable="yes">Search the grooveshark</property>
-                    <property name="invisible_char">&#x2022;</property>
+                    <property name="invisible_char"></property>
                     <property name="xalign">0.039999999105930328</property>
                     <property name="primary_icon_stock">gtk-find</property>
+                    <property name="primary_icon_activatable">False</property>
+                    <property name="secondary_icon_activatable">False</property>
                     <property name="primary_icon_sensitive">True</property>
                     <property name="secondary_icon_sensitive">True</property>
-                    <signal name="activate" handler="search_grooveshark"/>
+                    <signal name="activate" handler="search_grooveshark" swapped="no"/>
                   </object>
                 </child>
               </object>
             <child>
               <object class="GtkSeparatorToolItem" id="toolbutton12">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
               </object>
               <packing>
                 <property name="expand">False</property>
             <child>
               <object class="GtkToolButton" id="toolbutton10">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
                 <property name="tooltip_text" translatable="yes">Show selection info</property>
+                <property name="use_action_appearance">False</property>
                 <property name="label" translatable="yes">Info</property>
                 <property name="use_underline">True</property>
                 <property name="icon_name">dialog-information</property>
-                <signal name="clicked" handler="show_info"/>
+                <signal name="clicked" handler="show_info" swapped="no"/>
               </object>
               <packing>
                 <property name="expand">False</property>
             <child>
               <object class="GtkToolButton" id="toolbutton2">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
                 <property name="tooltip_text" translatable="yes">Download selected</property>
+                <property name="use_action_appearance">False</property>
                 <property name="label" translatable="yes">Download</property>
                 <property name="use_underline">True</property>
                 <property name="icon_name">go-down</property>
-                <signal name="clicked" handler="download_selected"/>
+                <signal name="clicked" handler="download_selected" swapped="no"/>
               </object>
               <packing>
                 <property name="expand">False</property>
             <child>
               <object class="GtkSeparatorToolItem" id="toolbutton4">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
               </object>
               <packing>
                 <property name="expand">False</property>
             <child>
               <object class="GtkToolButton" id="toolbutton14">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="tooltip_text" translatable="yes">Previous</property>
+                <property name="use_action_appearance">False</property>
                 <property name="label" translatable="yes">Previous</property>
                 <property name="use_underline">True</property>
                 <property name="stock_id">gtk-media-previous</property>
-                <signal name="clicked" handler="play_previous"/>
+                <signal name="clicked" handler="play_previous" swapped="no"/>
               </object>
               <packing>
                 <property name="expand">False</property>
             <child>
               <object class="GtkToolButton" id="toolbutton3">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
                 <property name="tooltip_text" translatable="yes">Play/Stop</property>
+                <property name="use_action_appearance">False</property>
                 <property name="label" translatable="yes">Play/Stop</property>
                 <property name="use_underline">True</property>
                 <property name="icon_name">media-playback-start</property>
-                <signal name="clicked" handler="play_selected"/>
+                <signal name="clicked" handler="play_selected" swapped="no"/>
               </object>
               <packing>
                 <property name="expand">False</property>
             <child>
               <object class="GtkToolButton" id="toolbutton9">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="tooltip_text" translatable="yes">Next</property>
+                <property name="use_action_appearance">False</property>
                 <property name="label" translatable="yes">Next</property>
                 <property name="use_underline">True</property>
                 <property name="stock_id">gtk-media-next</property>
-                <signal name="clicked" handler="play_next"/>
+                <signal name="clicked" handler="play_next" swapped="no"/>
               </object>
               <packing>
                 <property name="expand">False</property>
             <child>
               <object class="GtkToolItem" id="toolbutton13">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="use_action_appearance">False</property>
                 <child>
                   <object class="GtkVolumeButton" id="volumebutton1">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
                     <property name="has_tooltip">True</property>
+                    <property name="use_action_appearance">False</property>
                     <property name="relief">none</property>
                     <property name="focus_on_click">False</property>
                     <property name="orientation">vertical</property>
 audio-volume-high
 audio-volume-low
 audio-volume-medium</property>
-                    <signal name="value_changed" handler="on_volume_change"/>
+                    <signal name="value-changed" handler="on_volume_change" swapped="no"/>
                   </object>
                 </child>
               </object>
             <child>
               <object class="GtkToolButton" id="toolbutton5">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="tooltip_text" translatable="yes">Copy song name to clipboard</property>
+                <property name="use_action_appearance">False</property>
                 <property name="label" translatable="yes">Copyto Clipboard</property>
                 <property name="use_underline">True</property>
                 <property name="stock_id">gtk-copy</property>
-                <signal name="clicked" handler="copy_song"/>
+                <signal name="clicked" handler="copy_song" swapped="no"/>
               </object>
               <packing>
                 <property name="expand">False</property>
             <child>
               <object class="GtkSeparatorToolItem" id="toolbutton6">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
               </object>
               <packing>
                 <property name="expand">False</property>
             <child>
               <object class="GtkToolButton" id="toolbutton11">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="tooltip_text" translatable="yes">Open Prefrences</property>
+                <property name="use_action_appearance">False</property>
                 <property name="label" translatable="yes">Preferences</property>
                 <property name="use_underline">True</property>
                 <property name="stock_id">gtk-preferences</property>
-                <signal name="clicked" handler="edit_preferences"/>
+                <signal name="clicked" handler="edit_preferences" swapped="no"/>
               </object>
               <packing>
                 <property name="expand">False</property>
             <child>
               <object class="GtkToolButton" id="toolbutton7">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
                 <property name="tooltip_text" translatable="yes">Information about the application</property>
+                <property name="use_action_appearance">False</property>
                 <property name="label" translatable="yes">About</property>
                 <property name="use_underline">True</property>
                 <property name="stock_id">gtk-about</property>
-                <signal name="clicked" handler="show_about"/>
+                <signal name="clicked" handler="show_about" swapped="no"/>
               </object>
               <packing>
                 <property name="expand">False</property>
             <child>
               <object class="GtkToolButton" id="toolbutton8">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
                 <property name="tooltip_text" translatable="yes">Exit gSharkDown</property>
+                <property name="use_action_appearance">False</property>
                 <property name="label" translatable="yes">Quit</property>
                 <property name="use_underline">True</property>
                 <property name="stock_id">gtk-quit</property>
-                <signal name="clicked" handler="quit_app"/>
+                <signal name="clicked" handler="quit_app" swapped="no"/>
               </object>
               <packing>
                 <property name="expand">False</property>
           </object>
           <packing>
             <property name="expand">False</property>
+            <property name="fill">True</property>
             <property name="padding">1</property>
             <property name="position">0</property>
           </packing>
         <child>
           <object class="GtkVBox" id="vbox2">
             <property name="visible">True</property>
+            <property name="can_focus">False</property>
             <child>
               <object class="GtkHPaned" id="hpaned1">
                 <property name="visible">True</property>
                   <object class="GtkFrame" id="frame1">
                     <property name="width_request">400</property>
                     <property name="visible">True</property>
+                    <property name="can_focus">False</property>
                     <property name="label_xalign">0</property>
                     <property name="shadow_type">none</property>
                     <child>
                       <object class="GtkAlignment" id="alignment1">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <property name="left_padding">12</property>
                         <child>
                           <object class="GtkScrolledWindow" id="scrolledwindow1">
                     <child type="label">
                       <object class="GtkHBox" id="hbox3">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <child>
                           <object class="GtkImage" id="image7">
                             <property name="visible">True</property>
+                            <property name="can_focus">False</property>
                             <property name="stock">gtk-find</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="label1">
                             <property name="visible">True</property>
+                            <property name="can_focus">False</property>
                             <property name="label" translatable="yes">&lt;b&gt;Search Results&lt;/b&gt;</property>
                             <property name="use_markup">True</property>
                           </object>
                           <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
                             <property name="position">1</property>
                           </packing>
                         </child>
                   <object class="GtkFrame" id="frame2">
                     <property name="width_request">300</property>
                     <property name="visible">True</property>
+                    <property name="can_focus">False</property>
                     <property name="label_xalign">0</property>
                     <property name="shadow_type">none</property>
                     <child>
                       <object class="GtkAlignment" id="alignment2">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <property name="left_padding">12</property>
                         <child>
                           <object class="GtkVBox" id="vbox3">
                             <property name="visible">True</property>
+                            <property name="can_focus">False</property>
                             <child>
                               <object class="GtkScrolledWindow" id="scrolledwindow2">
                                 <property name="visible">True</property>
                                 </child>
                               </object>
                               <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
                                 <property name="position">0</property>
                               </packing>
                             </child>
                             <child>
                               <object class="GtkHBox" id="hbox1">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <child>
                                   <object class="GtkButton" id="button1">
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">True</property>
+                                    <property name="tooltip_text" translatable="yes">Add item from search results</property>
+                                    <property name="use_action_appearance">False</property>
                                     <property name="image">image2</property>
-                                    <signal name="clicked" handler="add_to_playlist"/>
+                                    <signal name="clicked" handler="add_to_playlist" swapped="no"/>
                                   </object>
                                   <packing>
                                     <property name="expand">False</property>
+                                    <property name="fill">True</property>
                                     <property name="position">0</property>
                                   </packing>
                                 </child>
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">True</property>
+                                    <property name="tooltip_text" translatable="yes">Remove item from playlist</property>
+                                    <property name="use_action_appearance">False</property>
                                     <property name="image">image3</property>
-                                    <signal name="clicked" handler="remove_from_playlist"/>
+                                    <signal name="clicked" handler="remove_from_playlist" swapped="no"/>
                                   </object>
                                   <packing>
                                     <property name="expand">False</property>
+                                    <property name="fill">True</property>
                                     <property name="position">1</property>
                                   </packing>
                                 </child>
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">True</property>
+                                    <property name="tooltip_text" translatable="yes">Clear the playlist</property>
+                                    <property name="use_action_appearance">False</property>
                                     <property name="image">image8</property>
-                                    <signal name="clicked" handler="clear_playlist"/>
+                                    <signal name="clicked" handler="clear_playlist" swapped="no"/>
                                   </object>
                                   <packing>
                                     <property name="expand">False</property>
+                                    <property name="fill">True</property>
                                     <property name="position">2</property>
                                   </packing>
                                 </child>
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">True</property>
+                                    <property name="tooltip_text" translatable="yes">Toggle Repeat all</property>
+                                    <property name="use_action_appearance">False</property>
                                     <property name="image">image4</property>
-                                    <signal name="toggled" handler="toggle_repeat"/>
+                                    <signal name="toggled" handler="toggle_repeat" swapped="no"/>
                                   </object>
                                   <packing>
                                     <property name="expand">False</property>
+                                    <property name="fill">True</property>
                                     <property name="position">3</property>
                                   </packing>
                                 </child>
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">True</property>
+                                    <property name="tooltip_text" translatable="yes">Toggle Shuffle</property>
+                                    <property name="use_action_appearance">False</property>
                                     <property name="image">image5</property>
-                                    <signal name="toggled" handler="toggle_shuffle"/>
+                                    <signal name="toggled" handler="toggle_shuffle" swapped="no"/>
                                   </object>
                                   <packing>
                                     <property name="expand">False</property>
+                                    <property name="fill">True</property>
                                     <property name="position">4</property>
                                   </packing>
                                 </child>
+                                <child>
+                                  <object class="GtkAlignment" id="alignment3">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <child>
+                                      <placeholder/>
+                                    </child>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">True</property>
+                                    <property name="fill">True</property>
+                                    <property name="position">5</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkButton" id="button4">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="receives_default">True</property>
+                                    <property name="tooltip_text" translatable="yes">Save playlist to file</property>
+                                    <property name="use_action_appearance">False</property>
+                                    <property name="image">image9</property>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">True</property>
+                                    <property name="position">6</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkButton" id="button5">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="receives_default">True</property>
+                                    <property name="tooltip_text" translatable="yes">Open saved playlist</property>
+                                    <property name="use_action_appearance">False</property>
+                                    <property name="image">image10</property>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">True</property>
+                                    <property name="position">7</property>
+                                  </packing>
+                                </child>
                               </object>
                               <packing>
                                 <property name="expand">False</property>
+                                <property name="fill">True</property>
                                 <property name="position">1</property>
                               </packing>
                             </child>
                     <child type="label">
                       <object class="GtkHBox" id="hbox2">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <child>
                           <object class="GtkImage" id="image6">
                             <property name="visible">True</property>
+                            <property name="can_focus">False</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="label2">
                             <property name="visible">True</property>
+                            <property name="can_focus">False</property>
                             <property name="label" translatable="yes">&lt;b&gt;Playlist&lt;/b&gt;</property>
                             <property name="use_markup">True</property>
                           </object>
                           <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
                             <property name="position">1</property>
                           </packing>
                         </child>
                 </child>
               </object>
               <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
                 <property name="padding">3</property>
                 <property name="position">0</property>
               </packing>
             </child>
           </object>
           <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
             <property name="padding">2</property>
             <property name="position">1</property>
           </packing>
         <child>
           <object class="GtkStatusbar" id="statusbar1">
             <property name="visible">True</property>
+            <property name="can_focus">False</property>
             <property name="spacing">2</property>
             <child>
               <object class="GtkLabel" id="songinfo">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
                 <property name="label" translatable="yes">label</property>
                 <property name="selectable">True</property>
                 <property name="single_line_mode">True</property>
               </object>
               <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
                 <property name="position">1</property>
               </packing>
             </child>
             <child>
               <object class="GtkProgressBar" id="progressbar1">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
                 <property name="pulse_step">0.01</property>
               </object>
               <packing>
                 <property name="expand">False</property>
+                <property name="fill">True</property>
                 <property name="position">2</property>
               </packing>
             </child>
           </object>
           <packing>
             <property name="expand">False</property>
+            <property name="fill">True</property>
             <property name="position">2</property>
           </packing>
         </child>
       </object>
     </child>
   </object>
-  <object class="GtkImage" id="image1">
-    <property name="visible">True</property>
-    <property name="pixel_size">25</property>
-    <property name="icon_name">audio-volume-high</property>
-  </object>
-  <object class="GtkImage" id="image2">
-    <property name="visible">True</property>
-    <property name="stock">gtk-add</property>
-  </object>
-  <object class="GtkImage" id="image3">
-    <property name="visible">True</property>
-    <property name="stock">gtk-delete</property>
-  </object>
-  <object class="GtkImage" id="image4">
-    <property name="visible">True</property>
-    <property name="icon_name">media-playlist-repeat</property>
-  </object>
-  <object class="GtkImage" id="image5">
-    <property name="visible">True</property>
-    <property name="icon_name">media-playlist-shuffle</property>
-  </object>
-  <object class="GtkImage" id="image8">
-    <property name="visible">True</property>
-    <property name="stock">gtk-clear</property>
-  </object>
 </interface>
         self.staticon.set_tooltip("gSharkDown : Download from Grooveshark")
 
         if os.path.exists("%s/.gsharkdown/playlist.pkl" % os.environ.get("HOME")):
-            self.load_saved_playlist()
+            self.load_saved_playlist("%s/.gsharkdown/playlist.pkl" % os.environ.get("HOME"))
         else:
             print "Playlist not found"
 
         self.check_for_update(None)
         self.window.show_all()
 
-    def load_saved_playlist(self):
-        file = open("%s/.gsharkdown/playlist.pkl" % os.environ.get("HOME"),
-                    'rb')
+    def load_saved_playlist(self, path):
+        file = open(path, 'rb')
         eoferror = True
         while eoferror:
             try:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.