ticket:485: add_stop_button_and_commandline_option.patch

File add_stop_button_and_commandline_option.patch, 6.4 kB (added by zdogde, 2 years ago)

patch that adds stop buttons

  • src/dbus_manager.py

     
    118118        def play_pause(self): 
    119119            Dispatcher.control("play") 
    120120            return "Successful command " 
     121 
     122        @dbus.service.method("org.gnome.Listen") 
     123        def stop(self): 
     124            Dispatcher.control("stop") 
     125            return "Successful command " 
    121126     
    122127        @dbus.service.method("org.gnome.Listen") 
    123128        def volume(self,value): 
  • src/option_parser.py

     
    4747                                 
    4848        self.parser.add_option("--play-pause", action="store_true", dest="play", default=False, 
    4949                                help=_("play or pause current playing media")) 
     50         
     51        self.parser.add_option("--stop", action="store_true", dest="stop", default=False, 
     52                                help=_("stop current playing media")) 
    5053                                 
    5154        self.parser.add_option("-c","--current-playing", action="store_true", dest="print_current", default=False, 
    5255                                help=_("show current playing song")) 
     
    9699        if self.options.play: 
    97100            ret = listen_dbus_interface.play() 
    98101             
     102        if self.options.stop: 
     103            ret = listen_dbus_interface.stop() 
     104             
    99105        if self.options.volume!=None: 
    100106            ret = listen_dbus_interface.volume(self.options.volume) 
    101107             
  • src/player/__init__.py

     
    5454                ()), 
    5555        "played" : (gobject.SIGNAL_RUN_LAST, 
    5656                gobject.TYPE_NONE, 
    57                 ()) 
     57                ()), 
     58        "stopped" : (gobject.SIGNAL_RUN_LAST, 
     59                gobject.TYPE_NONE, 
     60                ()), 
    5861    } 
    5962 
    6063    def __init__(self): 
     
    325328            config.set("player","play","false") 
    326329 
    327330    def stop(self): 
    328         self.daap_thread.stop()     
     331        #self.daap_thread.stop()     
    329332        self.debug("stop") 
    330         self.emit("paused") 
     333        self.emit("stopped") 
    331334        self.bin.set_state(gst.STATE_NULL) 
    332335        self.paused = True 
    333336        #self.song = None 
  • src/widget/control.py

     
    4848 
    4949        self.pack_start(build_btn(_("Previous"),gtk.STOCK_MEDIA_PREVIOUS,"previous"),False,False) 
    5050        self.pack_start(build_btn(_("Play"),gtk.STOCK_MEDIA_PLAY,"play"),False,False) 
     51        self.pack_start(build_btn(_("Stop"),gtk.STOCK_MEDIA_STOP,"stop"),False,False) 
    5152        self.pack_start(build_btn(_("Next"),gtk.STOCK_MEDIA_NEXT,"next"),False,False) 
    5253 
    5354        self.vol = VolumeSlider(player) 
     
    6364 
    6465        player.connect("played",self.swap_btn_play,gtk.STOCK_MEDIA_PAUSE) 
    6566        player.connect("paused",self.swap_btn_play,gtk.STOCK_MEDIA_PLAY) 
     67        player.connect("stopped",self.swap_btn_play,gtk.STOCK_MEDIA_PLAY) 
    6668 
    6769    def swap_btn_play(self,obj,stock): 
    6870        btn = self.get_children()[1].child.set_from_stock(stock,gtk.ICON_SIZE_LARGE_TOOLBAR) 
  • src/widget/listen.py

     
    114114         
    115115        player.connect("played",self.swap_menu_play,player,_("Pause"),gtk.STOCK_MEDIA_PAUSE,"listen_tray_play.png") 
    116116        player.connect("paused",self.swap_menu_play,player,("Play"),gtk.STOCK_MEDIA_PLAY,"listen_tray_pause.png") 
     117        player.connect("stopped",self.swap_menu_play,player,("Play"),gtk.STOCK_MEDIA_PLAY,"listen_tray.png") 
    117118         
    118119        self.tray = TrayIcon(self,player) 
    119120        self.tray.connect("control-action",self.player_ui.control,player) 
  • src/widget/player_ui.py

     
    152152                player.pause() 
    153153                if player.song: 
    154154                    player.set_song(player.song) 
    155              
    156              
     155         
     156        if action == "stop": 
     157            if not player.song_reported and player.song:  
     158                player.song.update_skipcount() 
     159            player.stop() 
     160              
    157161        if action == "shuffle": 
    158162            self.playlist.shuffle() 
    159163             
  • src/widget/tray.py

     
    4040        self.win = window 
    4141        player.connect("played",self.on_play) 
    4242        player.connect("paused",self.on_pause) 
     43        player.connect("stopped",self.on_pause) 
    4344 
    4445        self.eventbox = gtk.EventBox() 
    4546        try: import egg.trayicon 
     
    6162            <popup name="TrayIconMenu"> 
    6263              <menuitem name="play" action="play"/> 
    6364              <menuitem name="pause" action="pause"/> 
     65              <menuitem name="stop" action="stop"/> 
    6466              <menuitem name="next" action="next"/> 
    6567              <menuitem name="previous" action="previous"/> 
    6668              <separator/> 
     
    7476        actiongroup = gtk.ActionGroup('Listen') 
    7577        actiongroup.add_actions([('play', gtk.STOCK_MEDIA_PLAY, _('_Play'), None, _('Play'), lambda w:self.emit("control-action",w.get_name())), 
    7678                                 ('pause', gtk.STOCK_MEDIA_PAUSE, _('_Pause'), None, _('Pause'), lambda w:self.emit("control-action",w.get_name())), 
     79                                 ('stop', gtk.STOCK_MEDIA_STOP, _('Stop'), None, _('Stop'), lambda w:self.emit("control-action",w.get_name())), 
    7780                                 ('next', gtk.STOCK_MEDIA_NEXT, _('_Next'), None, _('Next'), lambda w:self.emit("control-action",w.get_name())), 
    7881                                 ('previous', gtk.STOCK_MEDIA_PREVIOUS, _('_Previous'), None, _('Previous'),lambda w:self.emit("control-action",w.get_name())), 
    7982                                 ('quit', gtk.STOCK_QUIT, _('_Quit'), None, _('Quit Listen'), lambda w:self.emit("control-action",w.get_name()))]) 
Mehdi ABAAKOUK