1
by Vadim Rutkovsky
Added possibility to download files |
1 |
# - encoding: utf8 -
|
2 |
#
|
|
3 |
# Copyright © 2010 Alexey Grunichev
|
|
4 |
#
|
|
5 |
# This program is free software: you can redistribute it and/or modify
|
|
6 |
# it under the terms of the GNU General Public License as published by
|
|
7 |
# the Free Software Foundation, either version 3 of the License, or
|
|
8 |
# (at your option) any later version.
|
|
9 |
#
|
|
10 |
# This program is distributed in the hope that it will be useful,
|
|
11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 |
# GNU General Public License for more details.
|
|
14 |
#
|
|
15 |
# You should have received a copy of the GNU General Public License
|
|
16 |
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17 |
||
18 |
||
19 |
import rb, rhythmdb |
|
20 |
import gobject, gtk |
|
21 |
from VkontakteSource import VkontakteSource |
|
22 |
||
23 |
popup_ui = """ |
|
24 |
<ui>
|
|
25 |
<popup name="VkontakteSourceViewPopup">
|
|
26 |
<menuitem name="AddToQueueLibraryPopup" action="AddToQueue"/>
|
|
27 |
</popup>
|
|
28 |
</ui>
|
|
29 |
"""
|
|
30 |
||
31 |
class VkontaktePlugin(rb.Plugin): |
|
32 |
||
33 |
def activate(self, shell): |
|
34 |
entry_type = shell.props.db.entry_register_type("VkontakteEntryType") |
|
35 |
source_group = rb.rb_source_group_get_by_name("library") |
|
36 |
self.source = gobject.new(VkontakteSource, name=_("Vkontakte"), shell=shell, plugin=self, entry_type=entry_type, source_group=source_group) |
|
37 |
# Set the source's icon
|
|
38 |
width, height = gtk.icon_size_lookup(gtk.ICON_SIZE_LARGE_TOOLBAR) |
|
39 |
icon = gtk.gdk.pixbuf_new_from_file_at_size(self.find_file("icon.ico"), width, height) |
|
40 |
self.source.props.icon = icon |
|
41 |
||
42 |
shell.append_source(self.source, None) |
|
43 |
shell.register_entry_type_for_source(self.source, entry_type) |
|
44 |
||
45 |
ui = shell.get_ui_manager() |
|
46 |
self.uid = ui.add_ui_from_string(popup_ui) |
|
47 |
ui.ensure_update() |
|
48 |
||
49 |
def deactivate(self, shell): |
|
50 |
self.source.delete_thyself() |
|
51 |
del self.source |