Ticket #485: add_stop_button_and_commandline_option.patch
| File add_stop_button_and_commandline_option.patch, 6.4 kB (added by zdogde, 1 year ago) |
|---|
-
src/dbus_manager.py
old new 118 118 def play_pause(self): 119 119 Dispatcher.control("play") 120 120 return "Successful command " 121 122 @dbus.service.method("org.gnome.Listen") 123 def stop(self): 124 Dispatcher.control("stop") 125 return "Successful command " 121 126 122 127 @dbus.service.method("org.gnome.Listen") 123 128 def volume(self,value): -
src/option_parser.py
old new 47 47 48 48 self.parser.add_option("--play-pause", action="store_true", dest="play", default=False, 49 49 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")) 50 53 51 54 self.parser.add_option("-c","--current-playing", action="store_true", dest="print_current", default=False, 52 55 help=_("show current playing song")) … … 96 99 if self.options.play: 97 100 ret = listen_dbus_interface.play() 98 101 102 if self.options.stop: 103 ret = listen_dbus_interface.stop() 104 99 105 if self.options.volume!=None: 100 106 ret = listen_dbus_interface.volume(self.options.volume) 101 107 -
src/player/__init__.py
old new 54 54 ()), 55 55 "played" : (gobject.SIGNAL_RUN_LAST, 56 56 gobject.TYPE_NONE, 57 ()) 57 ()), 58 "stopped" : (gobject.SIGNAL_RUN_LAST, 59 gobject.TYPE_NONE, 60 ()), 58 61 } 59 62 60 63 def __init__(self): … … 325 328 config.set("player","play","false") 326 329 327 330 def stop(self): 328 self.daap_thread.stop()331 #self.daap_thread.stop() 329 332 self.debug("stop") 330 self.emit(" paused")333 self.emit("stopped") 331 334 self.bin.set_state(gst.STATE_NULL) 332 335 self.paused = True 333 336 #self.song = None -
src/widget/control.py
old new 48 48 49 49 self.pack_start(build_btn(_("Previous"),gtk.STOCK_MEDIA_PREVIOUS,"previous"),False,False) 50 50 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) 51 52 self.pack_start(build_btn(_("Next"),gtk.STOCK_MEDIA_NEXT,"next"),False,False) 52 53 53 54 self.vol = VolumeSlider(player) … … 63 64 64 65 player.connect("played",self.swap_btn_play,gtk.STOCK_MEDIA_PAUSE) 65 66 player.connect("paused",self.swap_btn_play,gtk.STOCK_MEDIA_PLAY) 67 player.connect("stopped",self.swap_btn_play,gtk.STOCK_MEDIA_PLAY) 66 68 67 69 def swap_btn_play(self,obj,stock): 68 70 btn = self.get_children()[1].child.set_from_stock(stock,gtk.ICON_SIZE_LARGE_TOOLBAR) -
src/widget/listen.py
old new 114 114 115 115 player.connect("played",self.swap_menu_play,player,_("Pause"),gtk.STOCK_MEDIA_PAUSE,"listen_tray_play.png") 116 116 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") 117 118 118 119 self.tray = TrayIcon(self,player) 119 120 self.tray.connect("control-action",self.player_ui.control,player) -
src/widget/player_ui.py
old new 152 152 player.pause() 153 153 if player.song: 154 154 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 157 161 if action == "shuffle": 158 162 self.playlist.shuffle() 159 163 -
src/widget/tray.py
old new 40 40 self.win = window 41 41 player.connect("played",self.on_play) 42 42 player.connect("paused",self.on_pause) 43 player.connect("stopped",self.on_pause) 43 44 44 45 self.eventbox = gtk.EventBox() 45 46 try: import egg.trayicon … … 61 62 <popup name="TrayIconMenu"> 62 63 <menuitem name="play" action="play"/> 63 64 <menuitem name="pause" action="pause"/> 65 <menuitem name="stop" action="stop"/> 64 66 <menuitem name="next" action="next"/> 65 67 <menuitem name="previous" action="previous"/> 66 68 <separator/> … … 74 76 actiongroup = gtk.ActionGroup('Listen') 75 77 actiongroup.add_actions([('play', gtk.STOCK_MEDIA_PLAY, _('_Play'), None, _('Play'), lambda w:self.emit("control-action",w.get_name())), 76 78 ('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())), 77 80 ('next', gtk.STOCK_MEDIA_NEXT, _('_Next'), None, _('Next'), lambda w:self.emit("control-action",w.get_name())), 78 81 ('previous', gtk.STOCK_MEDIA_PREVIOUS, _('_Previous'), None, _('Previous'),lambda w:self.emit("control-action",w.get_name())), 79 82 ('quit', gtk.STOCK_QUIT, _('_Quit'), None, _('Quit Listen'), lambda w:self.emit("control-action",w.get_name()))])
