def __download_album(self, audio_dl_uri, sku):
		def download_progress(current, total):
			self.__downloads[str_uri] = (current, total)
			self.__notify_status_changed()

		def download_finished(uri, result):
			del self.__cancellables[str_uri]
			del self.__downloads[str_uri]

			try:
				success = uri.copy_finish(result)
			except Exception, e:
				success = False
				print "Download not completed: " + str(e)

			if success:
				threading.Thread(target=unzip_album).start()
			else:
				remove_download_files()

			if len(self.__downloads) == 0: # All downloads are complete
				shell = self.get_property('shell')
				manager = shell.get_player().get_property('ui-manager')
				manager.get_action("/MagnatuneSourceViewPopup/MagnatuneCancelDownload").set_sensitive(False)
				if success:
					width, height = gtk.icon_size_lookup(gtk.ICON_SIZE_LARGE_TOOLBAR)
					icon = rb.try_load_icon(gtk.icon_theme_get_default(), "magnatune", width, 0)
					shell.notify_custom(4000, _("Finished Downloading"), _("All Magnatune downloads have been completed."), icon, True)

			self.__notify_status_changed()
Example #2
0
    def activate(self, shell):
        self.shell = shell  # so the source can update the progress bar
        self.db = shell.get_property("db")

        self.entry_type = self.db.entry_register_type("MagnatuneEntryType")
        # allow changes which don't do anything
        self.entry_type.can_sync_metadata = True
        self.entry_type.sync_metadata = None

        theme = gtk.icon_theme_get_default()
        rb.append_plugin_source_path(theme, "/icons")

        width, height = gtk.icon_size_lookup(gtk.ICON_SIZE_LARGE_TOOLBAR)
        icon = rb.try_load_icon(theme, "magnatune", width, 0)

        group = rb.rb_source_group_get_by_name("stores")
        self.source = gobject.new(MagnatuneSource,
                                  shell=shell,
                                  entry_type=self.entry_type,
                                  source_group=group,
                                  icon=icon,
                                  plugin=self)

        shell.register_entry_type_for_source(self.source, self.entry_type)
        shell.append_source(self.source, None)  # Add the source to the list

        manager = shell.get_player().get_property('ui-manager')
        # Add the popup menu actions
        self.action_group = gtk.ActionGroup('MagnatunePluginActions')

        action = gtk.Action('MagnatuneDownloadAlbum', _('Download Album'),
                            _("Download this album from Magnatune"),
                            'gtk-save')
        action.connect(
            'activate', lambda a: self.shell.get_property("selected-source").
            download_album())
        self.action_group.add_action(action)
        action = gtk.Action('MagnatuneArtistInfo', _('Artist Information'),
                            _("Get information about this artist"), 'gtk-info')
        action.connect(
            'activate', lambda a: self.shell.get_property("selected-source").
            display_artist_info())
        self.action_group.add_action(action)
        action = gtk.Action('MagnatuneCancelDownload', _('Cancel Downloads'),
                            _("Stop downloading purchased albums"), 'gtk-stop')
        action.connect(
            'activate', lambda a: self.shell.get_property("selected-source").
            cancel_downloads())
        action.set_sensitive(False)
        self.action_group.add_action(action)

        manager.insert_action_group(self.action_group, 0)
        self.ui_id = manager.add_ui_from_string(popup_ui)

        self.pec_id = shell.get_player().connect('playing-song-changed',
                                                 self.playing_entry_changed)
        manager.ensure_update()
Example #3
0
	def do_activate(self):
		shell = self.object
		self.db = shell.props.db

		self.entry_type = MagnatuneEntryType()
		self.db.register_entry_type(self.entry_type)

		self.settings = Gio.Settings("org.gnome.rhythmbox.plugins.magnatune")

		theme = Gtk.IconTheme.get_default()
		rb.append_plugin_source_path(theme, "/icons")

		what, width, height = Gtk.icon_size_lookup(Gtk.IconSize.LARGE_TOOLBAR)
		icon = rb.try_load_icon(theme, "magnatune", width, 0)

		group = RB.DisplayPageGroup.get_by_id ("stores")
		settings = Gio.Settings("org.gnome.rhythmbox.plugins.magnatune")
		self.source = GObject.new(MagnatuneSource,
					  shell=shell,
					  entry_type=self.entry_type,
					  pixbuf=icon,
					  plugin=self,
					  settings=settings.get_child("source"),
					  name=_("Magnatune"),
					  toolbar_path="/MagnatuneToolBar")

		shell.register_entry_type_for_source(self.source, self.entry_type)
		shell.append_display_page(self.source, group)

		manager = shell.props.ui_manager
		# Add the popup menu actions
		self.action_group = Gtk.ActionGroup(name='MagnatunePluginActions')

		action = Gtk.Action(name='MagnatuneDownloadAlbum', label=_("Download Album"),
				tooltip=_("Download this album from Magnatune"),
				stock_id='gtk-save')
		action.connect('activate', lambda a: shell.props.selected_page.download_album())
		self.action_group.add_action(action)
		action = Gtk.Action(name='MagnatuneArtistInfo', label=_("Artist Information"),
				tooltip=_("Get information about this artist"),
				stock_id='gtk-info')
		action.connect('activate', lambda a: shell.props.selected_page.display_artist_info())
		self.action_group.add_action(action)
		action = Gtk.Action(name='MagnatuneCancelDownload', label=_("Cancel Downloads"),
				tooltip=_("Stop album downloads"),
				stock_id='gtk-stop')
		action.connect('activate', lambda a: shell.props.selected_page.cancel_downloads())
		action.set_sensitive(False)
		self.action_group.add_action(action)

		manager.insert_action_group(self.action_group, 0)
		self.ui_id = manager.add_ui_from_string(popup_ui)

		self.pec_id = shell.props.shell_player.connect('playing-song-changed', self.playing_entry_changed)
		manager.ensure_update()
Example #4
0
	def activate(self, shell):
		self.shell = shell # so the source can update the progress bar
		self.db = shell.get_property("db")

		self.entry_type = self.db.entry_register_type("MagnatuneEntryType")
		# allow changes which don't do anything
		self.entry_type.can_sync_metadata = True
		self.entry_type.sync_metadata = None

		theme = gtk.icon_theme_get_default()
		rb.append_plugin_source_path(theme, "/icons")

		width, height = gtk.icon_size_lookup(gtk.ICON_SIZE_LARGE_TOOLBAR)
		icon = rb.try_load_icon(theme, "magnatune", width, 0)

		group = rb.rb_source_group_get_by_name("stores")
		self.source = gobject.new(MagnatuneSource,
					  shell=shell,
					  entry_type=self.entry_type,
					  source_group=group,
					  icon=icon,
					  plugin=self)

		shell.register_entry_type_for_source(self.source, self.entry_type)
		shell.append_source(self.source, None) # Add the source to the list

		manager = shell.get_player().get_property('ui-manager')
		# Add the popup menu actions
		self.action_group = gtk.ActionGroup('MagnatunePluginActions')

		action = gtk.Action('MagnatuneDownloadAlbum', _('Download Album'),
				_("Download this album from Magnatune"),
				'gtk-save')
		action.connect('activate', lambda a: self.shell.get_property("selected-source").download_album())
		self.action_group.add_action(action)
		action = gtk.Action('MagnatuneArtistInfo', _('Artist Information'),
				_("Get information about this artist"),
				'gtk-info')
		action.connect('activate', lambda a: self.shell.get_property("selected-source").display_artist_info())
		self.action_group.add_action(action)
		action = gtk.Action('MagnatuneCancelDownload', _('Cancel Downloads'),
				_("Stop downloading purchased albums"),
				'gtk-stop')
		action.connect('activate', lambda a: self.shell.get_property("selected-source").cancel_downloads())
		action.set_sensitive(False)
		self.action_group.add_action(action)

		manager.insert_action_group(self.action_group, 0)
		self.ui_id = manager.add_ui_from_string(popup_ui)

		self.pec_id = shell.get_player().connect('playing-song-changed', self.playing_entry_changed)
		manager.ensure_update()
	def activate(self, shell):
		self.db = shell.get_property("db")

		self.entry_type = self.db.entry_register_type("JamendoEntryType")
		# allow changes which don't do anything
		self.entry_type.can_sync_metadata = True
		self.entry_type.sync_metadata = None

		group = rb.rb_source_group_get_by_name ("stores")
 		if not group:
 			group = rb.rb_source_group_register ("stores",
 							     _("Stores"),
 							     rb.SOURCE_GROUP_CATEGORY_FIXED)

		theme = gtk.icon_theme_get_default()
		rb.append_plugin_source_path(theme, "/icons/")

		width, height = gtk.icon_size_lookup(gtk.ICON_SIZE_LARGE_TOOLBAR)
		icon = rb.try_load_icon(theme, "jamendo", width, 0)

		self.source = gobject.new (JamendoSource,
					   shell=shell,
					   entry_type=self.entry_type,
					   plugin=self,
					   icon=icon,
					   source_group=group)
		shell.register_entry_type_for_source(self.source, self.entry_type)
		shell.append_source(self.source, None) # Add the source to the list

		# Add button
		manager = shell.get_player().get_property('ui-manager')
		action = gtk.Action('JamendoDownloadAlbum', _('_Download Album'),
				_("Download this album using BitTorrent"),
				'gtk-save')
		action.connect('activate', lambda a: shell.get_property("selected-source").download_album())
		self.action_group = gtk.ActionGroup('JamendoPluginActions')
		self.action_group.add_action(action)
		
		# Add Button for Donate
		action = gtk.Action('JamendoDonateArtist', _('_Donate to Artist'),
				_("Donate Money to this Artist"),
				'gtk-jump-to')
		action.connect('activate', lambda a: shell.get_property("selected-source").launch_donate())
		self.action_group.add_action(action)

		manager.insert_action_group(self.action_group, 0)
		self.ui_id = manager.add_ui_from_string(popup_ui)
		manager.ensure_update()

		self.pec_id = shell.get_player().connect('playing-song-changed', self.playing_entry_changed)
Example #6
0
	def activate(self, shell):
	
		#logging
		log.setLevel(logging.DEBUG)
		console_handler = logging.StreamHandler()
		console_handler.setLevel(logging.DEBUG)
		console_handler.setFormatter(logging.Formatter('%(name)s %(levelname)-8s %(module)s::%(funcName)s - %(message)s'))
		log.addHandler(console_handler)
		self._shell=shell
		self._handler = [
				shell.props.shell_player.connect('playing-song-changed', self._on_playing_song_changed)]
		self._ui=UI.UI();
		self.build_actions()
		self._setup=Setup.SetupBox()
		
		self.db = shell.get_property("db")
		try:
			self.entry_type = DoubanFMEntryType()
			self.db.register_entry_type(self.entry_type)
		except NotImplementedError:
			self.entry_type = self.db.entry_register_type("DoubanFMEntryType")
			# allow changes which don't do anything
		self.entry_type.can_sync_metadata = True
		self.entry_type.sync_metadata = None
		
		theme = gtk.icon_theme_get_default()
	
		width, height = gtk.icon_size_lookup(gtk.ICON_SIZE_LARGE_TOOLBAR)
		icon = rb.try_load_icon(theme, "doubanFM", width, 0)
		
		#group = rb.rb_source_group_get_by_name ("stores")
		group = rb.rb_display_page_group_get_by_id ("stores")
		self.source =gobject.new(DoubanFMSource,
						   shell=shell,
						   entry_type=self.entry_type,
						   pixbuf=icon,
						   plugin=self)				   
		shell.register_entry_type_for_source(self.source, self.entry_type)
		shell.append_display_page(self.source, group)
		#shell.append_source(self.source, None) 
		self._uiManager=shell.props.ui_manager
		self._uiManager.insert_action_group(self.actionGroup)
		# self.uiMergeid=self._uiManager.add_ui_from_file(self.find_file("UI.xml"))
		#生成界面
		log.info(self._ui.buildUIString())
		self.uiMergeid=self._uiManager.add_ui_from_string(self._ui.buildUIString())
		self._uiManager.ensure_update()
		if gconf.client_get_default().get_without_default(Setup.ENABLE_INDICATOR).get_bool():
			doubanIndicator=DoubanIndicator.DoubanIndicator()
			doubanIndicator.indicator(shell,self)
Example #7
0
	def activate(self, shell):
	
		#logging
		log.setLevel(logging.DEBUG)
		console_handler = logging.StreamHandler()
		console_handler.setLevel(logging.DEBUG)
		console_handler.setFormatter(logging.Formatter('%(name)s %(levelname)-8s %(module)s::%(funcName)s - %(message)s'))
		log.addHandler(console_handler)
		self._shell=shell
		self._handler = [
				shell.props.shell_player.connect('playing-song-changed', self._on_playing_song_changed)]
		self._ui=UI.UI();
		self.build_actions()
		self._setup=Setup.SetupBox()
		
		self.db = shell.get_property("db")
		try:
			self.entry_type = DoubanFMEntryType()
			self.db.register_entry_type(self.entry_type)
		except NotImplementedError:
			self.entry_type = self.db.entry_register_type("DoubanFMEntryType")
			# allow changes which don't do anything
		self.entry_type.can_sync_metadata = True
		self.entry_type.sync_metadata = None
		
		theme = gtk.icon_theme_get_default()
	
		width, height = gtk.icon_size_lookup(gtk.ICON_SIZE_LARGE_TOOLBAR)
		icon = rb.try_load_icon(theme, "doubanFM", width, 0)
		
		group = rb.rb_source_group_get_by_name ("stores")
		self.source =gobject.new(DoubanFMSource,
						   shell=shell,
						   entry_type=self.entry_type,
						   plugin=self,
						   icon=icon,
						   source_group=group)
		shell.register_entry_type_for_source(self.source, self.entry_type)
		shell.append_source(self.source, None) 
		self._uiManager=shell.props.ui_manager
		self._uiManager.insert_action_group(self.actionGroup)
		# self.uiMergeid=self._uiManager.add_ui_from_file(self.find_file("UI.xml"))
		#生成界面
		
		self.uiMergeid=self._uiManager.add_ui_from_string(self._ui.buildUIString())
		self._uiManager.ensure_update()
		if gconf.client_get_default().get_without_default(Setup.ENABLE_INDICATOR).get_bool():
			doubanIndicator=DoubanIndicator.DoubanIndicator()
			doubanIndicator.indicator(shell,self)
Example #8
0
    def activate(self, shell):
        self.db = shell.get_property("db")

        self.entry_type = self.db.entry_register_type("JamendoEntryType")
        # allow changes which don't do anything
        self.entry_type.can_sync_metadata = True
        self.entry_type.sync_metadata = None

        theme = gtk.icon_theme_get_default()
        rb.append_plugin_source_path(theme, "/icons/")

        width, height = gtk.icon_size_lookup(gtk.ICON_SIZE_LARGE_TOOLBAR)
        icon = rb.try_load_icon(theme, "jamendo", width, 0)

        group = rb.rb_source_group_get_by_name("stores")
        self.source = gobject.new(JamendoSource,
                                  shell=shell,
                                  entry_type=self.entry_type,
                                  plugin=self,
                                  icon=icon,
                                  source_group=group)
        shell.register_entry_type_for_source(self.source, self.entry_type)
        shell.append_source(self.source, None)  # Add the source to the list

        # Add button
        manager = shell.get_player().get_property('ui-manager')
        action = gtk.Action('JamendoDownloadAlbum', _('_Download Album'),
                            _("Download this album using BitTorrent"),
                            'gtk-save')
        action.connect(
            'activate',
            lambda a: shell.get_property("selected-source").download_album())
        self.action_group = gtk.ActionGroup('JamendoPluginActions')
        self.action_group.add_action(action)

        # Add Button for Donate
        action = gtk.Action('JamendoDonateArtist', _('_Donate to Artist'),
                            _("Donate Money to this Artist"), 'gtk-jump-to')
        action.connect(
            'activate',
            lambda a: shell.get_property("selected-source").launch_donate())
        self.action_group.add_action(action)

        manager.insert_action_group(self.action_group, 0)
        self.ui_id = manager.add_ui_from_string(popup_ui)
        manager.ensure_update()

        self.pec_id = shell.get_player().connect('playing-song-changed',
                                                 self.playing_entry_changed)
Example #9
0
  def activate(self, shell):
    self.db = shell.props.db

    group = rb.rb_source_group_get_by_name ("online")
    if not group:
        group = rb.rb_source_group_register ("online",
                             _("Online"),
                             rb.SOURCE_GROUP_CATEGORY_FIXED)

    self.entry_type = self.db.entry_register_type("GoogleMusic")
    self.entry_type.get_playback_uri=self.get_playback_uri
    theme = gtk.icon_theme_get_default()
    theme.append_search_path(os.path.join(self.__get_plugins_dir(), "icons"))
    rb.append_plugin_source_path(theme, "/icons")

    width, height = gtk.icon_size_lookup(gtk.ICON_SIZE_LARGE_TOOLBAR)
    icon = rb.try_load_icon(theme, "googlemusic", width, 0)

    self.source = gobject.new (OnlineMusicSource,
                   shell=shell,
                   entry_type=self.entry_type,
                   source_group=group,
                   name = _("Google Music"),
                   icon=icon,
                   plugin=self)

    shell.register_entry_type_for_source(self.source, self.entry_type)
    shell.append_source(self.source, None)

    # First lets see if we can add to the context menu
    ui = shell.get_ui_manager()

    # Group and it's actions
    self.action_group = gtk.ActionGroup ('TestActions')

    # Create Actions for the plugin
    action = gtk.Action ('ReloadMusic', _('Reload music'),
                         _('Reload music'),
                         'gtk-refresh')
    activate_id = action.connect ('activate', lambda a: self.source.onlineMusic.reloadMusic())#self.source.onlineMusic.activate()
    self.action_group.add_action (action)
    action = gtk.Action ('SwitchList', _('Switch List'),
                         _('Switch List'),
                         'gtk-properties')#gtk-preferences
    activate_id = action.connect ('activate', lambda a: self.switch_list())
    self.action_group.add_action (action)

    ui.insert_action_group(self.action_group, -1)
Example #10
0
 def do_activate(self):
     shell = self.object
     db = shell.props.db
     model = RB.RhythmDBQueryModel.new_empty(db)
     theme = Gtk.IconTheme.get_default()
     what, width, height = Gtk.icon_size_lookup(Gtk.IconSize.LARGE_TOOLBAR)
     icon = rb.try_load_icon(theme, "media-playback-start", width, 0)
     self.source = GObject.new(
         GPlaySource, shell=shell,
         name="Google Music",
         query_model=model,
         plugin=self,
         pixbuf=icon,
     )
     self.source.setup()
     group = RB.DisplayPageGroup.get_by_id("library")
     shell.append_display_page(self.source, group)
Example #11
0
 def do_activate(self):
     shell = self.object
     db = shell.props.db
     model = RB.RhythmDBQueryModel.new_empty(db)
     theme = Gtk.IconTheme.get_default()
     what, width, height = Gtk.icon_size_lookup(Gtk.IconSize.LARGE_TOOLBAR)
     icon = rb.try_load_icon(theme, "media-playback-start", width, 0)
     self.source = GObject.new(
         GPlaySource, shell=shell, 
         name="Google Music",
         query_model=model,
         plugin=self,
         pixbuf=icon,
     )
     self.source.setup()
     group = RB.DisplayPageGroup.get_by_id ("library")
     shell.append_display_page(self.source, group)
Example #12
0
	def do_activate(self):
		shell = self.object
		self.db = shell.props.db

		self.entry_type = JamendoEntryType()
		self.db.register_entry_type(self.entry_type)

		theme = Gtk.IconTheme.get_default()
		rb.append_plugin_source_path(theme, "/icons/")

		what, width, height = Gtk.icon_size_lookup(Gtk.IconSize.LARGE_TOOLBAR)
		icon = rb.try_load_icon(theme, "jamendo", width, 0)

		group = RB.DisplayPageGroup.get_by_id ("stores")
		settings = Gio.Settings("org.gnome.rhythmbox.plugins.jamendo")
		self.source = gobject.new (JamendoSource,
					   shell=shell,
					   entry_type=self.entry_type,
					   plugin=self,
					   pixbuf=icon,
					   settings=settings.get_child("source"))
		shell.register_entry_type_for_source(self.source, self.entry_type)
		shell.append_display_page(self.source, group)

		# Add button
		manager = shell.props.ui_manager
		action = Gtk.Action(name='JamendoDownloadAlbum', label=_('_Download Album'),
				tooltip=_("Download this album using BitTorrent"),
				stock_id='gtk-save')
		action.connect('activate', lambda a: shell.props.selected_page.download_album())
		self.action_group = Gtk.ActionGroup('JamendoPluginActions')
		self.action_group.add_action(action)
		
		# Add Button for Donate
		action = Gtk.Action(name='JamendoDonateArtist', label=_('_Donate to Artist'),
				tooltip=_("Donate Money to this Artist"),
				stock_id='gtk-jump-to')
		action.connect('activate', lambda a: shell.props.selected_page.launch_donate())
		self.action_group.add_action(action)

		manager.insert_action_group(self.action_group, 0)
		self.ui_id = manager.add_ui_from_string(popup_ui)
		manager.ensure_update()

		self.pec_id = shell.props.shell_player.connect('playing-song-changed', self.playing_entry_changed)
Example #13
0
    def activate(self, shell):
        self.db = shell.get_property("db")

        self.entry_type = JamendoEntryType()
        self.db.register_entry_type(self.entry_type)

        theme = gtk.icon_theme_get_default()
        rb.append_plugin_source_path(theme, "/icons/")

        width, height = gtk.icon_size_lookup(gtk.ICON_SIZE_LARGE_TOOLBAR)
        icon = rb.try_load_icon(theme, "jamendo", width, 0)

        group = rb.rb_source_group_get_by_name("stores")
        self.source = gobject.new(
            JamendoSource, shell=shell, entry_type=self.entry_type, plugin=self, icon=icon, source_group=group
        )
        shell.register_entry_type_for_source(self.source, self.entry_type)
        shell.append_source(self.source, None)  # Add the source to the list

        # Add button
        manager = shell.get_player().get_property("ui-manager")
        action = gtk.Action(
            "JamendoDownloadAlbum", _("_Download Album"), _("Download this album using BitTorrent"), "gtk-save"
        )
        action.connect("activate", lambda a: shell.get_property("selected-source").download_album())
        self.action_group = gtk.ActionGroup("JamendoPluginActions")
        self.action_group.add_action(action)

        # Add Button for Donate
        action = gtk.Action(
            "JamendoDonateArtist", _("_Donate to Artist"), _("Donate Money to this Artist"), "gtk-jump-to"
        )
        action.connect("activate", lambda a: shell.get_property("selected-source").launch_donate())
        self.action_group.add_action(action)

        manager.insert_action_group(self.action_group, 0)
        self.ui_id = manager.add_ui_from_string(popup_ui)
        manager.ensure_update()

        self.pec_id = shell.get_player().connect("playing-song-changed", self.playing_entry_changed)
Example #14
0
	def run(self,rbshell,rbplugin):
		print "Avahi THINGS !!!!!!!!!!!!!!"
		self.shell=rbshell
		self.rbplugin=rbplugin

		#GUI allgemein vorbereiten
		self.db = self.shell.get_property("db")
		self.entry_type = self.db.entry_register_type("RemoteEntryType")
		self.entry_type.can_sync_metadata = True
                self.entry_type.sync_metadata = None
                theme = gtk.icon_theme_get_default()
                rb.append_plugin_source_path(theme, "/icons/")
                width, height = gtk.icon_size_lookup(gtk.ICON_SIZE_LARGE_TOOLBAR)
                self.icon = rb.try_load_icon(theme, "jamendo", width, 0)
                self.group = rb.rb_source_group_get_by_name ("stores")

		#DBUS lauschen auf remotes
		bus=dbus.SystemBus()#mainloop=loop)
		self.server = dbus.Interface(bus.get_object('org.freedesktop.Avahi','/'),"org.freedesktop.Avahi.Server")
		b = dbus.Interface(bus.get_object(avahi.DBUS_NAME,self.server.ServiceBrowserNew(avahi.IF_UNSPEC,avahi.PROTO_UNSPEC,"_touch-remote._tcp", 'local', dbus.UInt32(0))),avahi.DBUS_INTERFACE_SERVICE_BROWSER)
		b.connect_to_signal("ItemNew",self.newRemote)
		b.connect_to_signal("ItemRemove",self.RemoteRemoved)
    def __download_album(self, audio_dl_uri, sku):
        def download_progress(current, total):
            self.__downloads[str_uri] = (current, total)
            self.__notify_status_changed()

        def download_finished(uri, result):
            del self.__cancellables[str_uri]
            del self.__downloads[str_uri]

            try:
                success = uri.copy_finish(result)
            except Exception, e:
                success = False
                print "Download not completed: " + str(e)

            if success:
                threading.Thread(target=unzip_album).start()
            else:
                remove_download_files()

            if len(self.__downloads) == 0:  # All downloads are complete
                shell = self.get_property('shell')
                manager = shell.get_player().get_property('ui-manager')
                manager.get_action(
                    "/MagnatuneSourceViewPopup/MagnatuneCancelDownload"
                ).set_sensitive(False)
                if success:
                    width, height = gtk.icon_size_lookup(
                        gtk.ICON_SIZE_LARGE_TOOLBAR)
                    icon = rb.try_load_icon(gtk.icon_theme_get_default(),
                                            "magnatune", width, 0)
                    shell.notify_custom(
                        4000, _("Finished Downloading"),
                        _("All Magnatune downloads have been completed."),
                        icon, True)

            self.__notify_status_changed()
Example #16
0
    def activate(self, shell):
        self.db = shell.get_property("db")
        self.entry_type = BlofeldEntryType()
        self.db.register_entry_type(self.entry_type)
        model = self.db.query_model_new_empty()
        group = rb.rb_source_group_get_by_name ("library")
        if not group:
            group = rb.rb_source_group_register ("library",
                _("Library"),
                rb.SOURCE_GROUP_CATEGORY_FIXED)
        theme = gtk.icon_theme_get_default()
        rb.append_plugin_source_path(theme, "/icons")

        width, height = gtk.icon_size_lookup(gtk.ICON_SIZE_LARGE_TOOLBAR)
        icon = rb.try_load_icon(theme, "network-server", width, 0)
        self.source = gobject.new (BlofeldSource,
                        shell=shell,
                        entry_type=self.entry_type,
                        source_group=group,
                        icon=icon,
                        plugin=self)
        shell.register_entry_type_for_source(self.source, self.entry_type)
        shell.append_source(self.source, None) # Add the source to the list
        self.pec_id = shell.get_player().connect('playing-song-changed', self.playing_entry_changed)
    def do_activate(self):
        shell = self.object
        self.db = shell.props.db

        self.entry_type = MagnatuneEntryType()
        self.db.register_entry_type(self.entry_type)

        self.settings = Gio.Settings("org.gnome.rhythmbox.plugins.magnatune")

        theme = Gtk.IconTheme.get_default()
        rb.append_plugin_source_path(theme, "/icons")

        what, width, height = Gtk.icon_size_lookup(Gtk.IconSize.LARGE_TOOLBAR)
        icon = rb.try_load_icon(theme, "magnatune", width, 0)

        group = RB.DisplayPageGroup.get_by_id("stores")
        settings = Gio.Settings("org.gnome.rhythmbox.plugins.magnatune")
        self.source = GObject.new(MagnatuneSource,
                                  shell=shell,
                                  entry_type=self.entry_type,
                                  pixbuf=icon,
                                  plugin=self,
                                  settings=settings.get_child("source"),
                                  name=_("Magnatune"),
                                  toolbar_path="/MagnatuneToolBar")

        shell.register_entry_type_for_source(self.source, self.entry_type)
        shell.append_display_page(self.source, group)

        manager = shell.props.ui_manager
        # Add the popup menu actions
        self.action_group = Gtk.ActionGroup(name='MagnatunePluginActions')

        action = Gtk.Action(name='MagnatuneDownloadAlbum',
                            label=_("Download Album"),
                            tooltip=_("Download this album from Magnatune"),
                            stock_id='gtk-save')
        action.connect('activate',
                       lambda a: shell.props.selected_page.download_album())
        self.action_group.add_action(action)
        action = Gtk.Action(name='MagnatuneArtistInfo',
                            label=_("Artist Information"),
                            tooltip=_("Get information about this artist"),
                            stock_id='gtk-info')
        action.connect(
            'activate',
            lambda a: shell.props.selected_page.display_artist_info())
        self.action_group.add_action(action)
        action = Gtk.Action(name='MagnatuneCancelDownload',
                            label=_("Cancel Downloads"),
                            tooltip=_("Stop album downloads"),
                            stock_id='gtk-stop')
        action.connect('activate',
                       lambda a: shell.props.selected_page.cancel_downloads())
        action.set_sensitive(False)
        self.action_group.add_action(action)

        manager.insert_action_group(self.action_group, 0)
        self.ui_id = manager.add_ui_from_string(popup_ui)

        self.pec_id = shell.props.shell_player.connect(
            'playing-song-changed', self.playing_entry_changed)
        manager.ensure_update()