Example #1
0
    def _create_menu(self):
        # for the standard menu control button add the button
        # to all supported view types
        app = Gio.Application.get_default()
        self.app_id = 'coverart-browser'

        action_name = 'coverart-browser-views'
        self.action = Gio.SimpleAction.new_stateful(
            action_name, GLib.VariantType.new('s'),
            self._views.get_action_name(ListView.name))
        self.action.connect("activate", self.view_change_cb)
        app.add_action(self.action)

        menu_item = Gio.MenuItem()
        section = Gio.Menu()
        menu = Gio.Menu()
        toolbar_item = Gio.MenuItem()

        for view_name in self._views.get_view_names():
            menu_item.set_label(self._views.get_menu_name(view_name))
            menu_item.set_action_and_target_value(
                'app.' + action_name, self._views.get_action_name(view_name))
            section.append_item(menu_item)

        menu.append_section(None, section)

        cl = CoverLocale()
        cl.switch_locale(cl.Locale.LOCALE_DOMAIN)
        toolbar_item.set_label('…')
        cl.switch_locale(cl.Locale.RB)

        toolbar_item.set_submenu(menu)
        for location in self.locations:
            app.add_plugin_menu_item(location, self.app_id, toolbar_item)
Example #2
0
    def do_activate(self):
        self.shell = self.object

        self.__action = Gio.SimpleAction(name='open')
        self.__action.connect('activate', self.apply_command)

        app = Gio.Application.get_default()
        app.add_action(self.__action)

        # Receive fourth submenu
        menu = self.shell.props.application.get_menubar()
        assert menu.get_n_items() > 3, 'But I need fourth submenu'
        it = menu.iterate_item_links(3)
        it.next()
        self.menu = it.get_value()

        item = Gio.MenuItem()
        if locale.getlocale()[0] == 'ru_RU':
            item.set_label("Открыть...")
        else:
            item.set_label(_("Open..."))
        item.set_detailed_action('app.open')
        item.set_attribute_value('accel', Variant('s', '<Ctrl>L'))
        self.menu.append_item(item)
        app.add_plugin_menu_item('edit', 'open', item)
        app.add_plugin_menu_item('browser-popup', 'open', item)
        app.add_plugin_menu_item('playlist-popup', 'open', item)
        app.add_plugin_menu_item('queue-popup', 'open', item)
Example #3
0
    def do_activate(self):
        shell = self.object
        app = shell.props.application
        self.window = shell.props.window

        self.action1 = Gio.SimpleAction.new("import-playlists", None)
        self.action1.connect("activate", self.import_playlists, shell)
        self.action2 = Gio.SimpleAction.new("export-playlists", None)
        self.action2.connect("activate", self.export_playlists, shell)
        self.action3 = Gio.SimpleAction(name="update-playlist")
        self.action3.connect("activate", self.update_playlist, shell)

        self.window.add_action(self.action1)
        self.window.add_action(self.action2)
        self.window.add_action(self.action3)

        item1 = Gio.MenuItem.new(label="Import playlists", detailed_action="win.import-playlists")
        item2 = Gio.MenuItem.new(label="Export playlists", detailed_action="win.export-playlists")
        item3 = Gio.MenuItem.new(label="Update this playlist", detailed_action="win.update-playlist")

        app.add_plugin_menu_item("tools", "import-playlists", item1)
        app.add_plugin_menu_item("tools", "export-playlists", item2)
        app.add_plugin_menu_item("tools", "update-playlist", item3)
        
        # create menu item for rightclick in playlist view
        item = Gio.MenuItem()
        item.set_label("Update this playlist")
        item.set_detailed_action("app.update-playlist")

        # add plugin menu item
        for menu_name in PlaylistLoadSavePlugin._menu_names:
            app.add_plugin_menu_item(menu_name, "Update this playlist", item)
        app.add_action(self.action3)
Example #4
0
 def test_menu_item(self):
     menu = Gio.Menu()
     item = Gio.MenuItem()
     item.set_attribute([("label", "s", "Test"),
                         ("action", "s", "app.test")])
     menu.append_item(item)
     value = menu.get_item_attribute_value(0, "label", GLib.VariantType.new("s"))
     self.assertEqual("Test", value.unpack())
     value = menu.get_item_attribute_value(0, "action", GLib.VariantType.new("s"))
     self.assertEqual("app.test", value.unpack())
Example #5
0
        def add_browser_menuitems(self, ui_string, group_name):
            """
            utility function to add popup menu items to existing browser popups

            For RB2.99 all menu items are are assumed to be of action_type
            "win".

            For RB2.98 or less, it is added however the UI_MANAGER string
            is defined.

            :param ui_string: `str` is the Gtk UI definition.  There is not an
            equivalent UI definition in RB2.99 but we can parse out menu items
            since this string is in XML format

            :param group_name: `str` unique name of the ActionGroup to add menu
            items to
            """
            if is_rb3(self.shell):
                root = ET.fromstring(ui_string)
                for elem in root.findall("./popup"):
                    popup_name = elem.attrib['name']

                    menuelem = elem.find('.//menuitem')
                    action_name = menuelem.attrib['action']

                    group = self._action_groups[group_name]
                    act = group.get_action(action_name)

                    item = Gio.MenuItem()
                    item.set_detailed_action('win.' + action_name)
                    item.set_label(act.label)
                    app = Gio.Application.get_default()

                    if popup_name == 'QueuePlaylistViewPopup':
                        plugin_type = 'queue-popup'
                    elif popup_name == 'BrowserSourceViewPopup':
                        plugin_type = 'browser-popup'
                    elif popup_name == 'PlaylistViewPopup':
                        plugin_type = 'playlist-popup'
                    elif popup_name == 'PodcastViewPopup':
                        plugin_type = 'podcast-episode-popup'
                    else:
                        print("unknown type %s" % plugin_type)

                    index = plugin_type + action_name
                    app.add_plugin_menu_item(plugin_type, index, item)
                    self._uids[index] = plugin_type
            else:
                uim = self.shell.props.ui_manager
                self._uids.append(uim.add_ui_from_string(ui_string))
                uim.ensure_update()
Example #6
0
    def do_activate(self):
        self.__action = Gio.SimpleAction(name='sendto')
        self.__action.connect('activate', self.send_to)

        app = Gio.Application.get_default()
        app.add_action(self.__action)

        item = Gio.MenuItem()
        item.set_label(_("Send to..."))
        item.set_detailed_action('app.sendto')
        app.add_plugin_menu_item('edit', 'sendto', item)
        app.add_plugin_menu_item('browser-popup', 'sendto', item)
        app.add_plugin_menu_item('playlist-popup', 'sendto', item)
        app.add_plugin_menu_item('queue-popup', 'sendto', item)
    def do_activate(self):
        """Activate the plugin."""
        print('edit-file plugin: Activating')

        action = Gio.SimpleAction(name=EditFile._action)
        action.connect('activate', self.edit_file)
        self._app.add_action(action)

        item = Gio.MenuItem()
        item.set_label('Edit file')
        item.set_detailed_action('app.%s' % EditFile._action)

        for location in EditFile._locations:
            self._app.add_plugin_menu_item(location, EditFile._action, item)
    def do_activate(self):
        """Activate the plugin."""
        logging.debug('Activating plugin...')

        action = Gio.SimpleAction(name=OpenContainingFolder._action)
        action.connect('activate', self.open_folder)
        self._app.add_action(action)

        item = Gio.MenuItem()
        item.set_label('Open containing folder')
        item.set_detailed_action('app.%s' % OpenContainingFolder._action)

        for location in OpenContainingFolder._locations:
            self._app.add_plugin_menu_item(location,
                                           OpenContainingFolder._action, item)
Example #9
0
    def _init_ui(self):
        # Used https://github.com/fossfreedom/alternative-toolbar/blob/master/alttoolbar_rb3compat.py as documentation
        print("Extending the UI with our own actions")
        self.update_action = Gio.SimpleAction(name="updatelastfmplaycount")
        self.update_action.connect('activate', self.update_all)
        self.app.add_action(self.update_action)

        self.update_menu_item = Gio.MenuItem()
        # So, if you're reading this code hoping to find the solution to all
        # your gobject woes, then please do note the "app." prefix on the next
        # line. It will make your life okay again, I promise.
        self.update_menu_item.set_detailed_action('app.updatelastfmplaycount')
        self.update_menu_item.set_label("Update Last.fm playcount")
        self.app.add_plugin_menu_item('tools', 'updatelastfmplaycount',
                                      self.update_menu_item)
Example #10
0
    def _set_mediatypes_menu(self):
        self._set_mediatypes_action()
        menu = Gio.Menu()

        for mediatype in self._engine.api_info['supported_mediatypes']:
            variant = GLib.Variant.new_string(mediatype)
            menu_item = Gio.MenuItem()
            menu_item.set_label(mediatype)
            menu_item.set_action_and_target_value('win.change-mediatype',
                                                  variant)
            menu.append_item(menu_item)

        self.btn_mediatype.set_menu_model(menu)

        if len(self._engine.api_info['supported_mediatypes']) <= 1:
            self.btn_mediatype.hide()
Example #11
0
    def do_activate(self):
        """Activate the plugin."""
        logging.debug('Activating plugin...')

        rb_settings = Gio.Settings("org.gnome.rhythmbox")

        action = Gio.SimpleAction(name=FadeToSong._action)
        action.connect('activate', self.fade_to_next)
        self._app.add_action(action)

        item = Gio.MenuItem()
        item.set_label('Fade to next song')
        item.set_detailed_action('app.%s' % FadeToSong._action)

        for location in FadeToSong._locations:
            self._app.add_plugin_menu_item(location, FadeToSong._action, item)
Example #12
0
    def build_sc_menu(self):
        menu = {}

        # playing track
        shell = self.props.shell
        player = shell.props.shell_player
        entry = player.get_playing_entry()
        if entry is not None and entry.get_entry_type(
        ) == self.props.entry_type:
            url = entry.get_string(RB.RhythmDBPropType.LOCATION)
            menu[url] = _("View '%(title)s' on SoundCloud") % {
                'title': entry.get_string(RB.RhythmDBPropType.TITLE)
            }
            # artist too?

        # selected track
        if self.songs.have_selection():
            entry = self.songs.get_selected_entries()[0]
            url = entry.get_string(RB.RhythmDBPropType.LOCATION)
            menu[url] = _("View '%(title)s' on SoundCloud") % {
                'title': entry.get_string(RB.RhythmDBPropType.TITLE)
            }
            # artist too?

        # selected container
        selection = self.container_view.get_selection()
        (model, aiter) = selection.get_selected()
        if aiter is not None:
            [name, url] = model.get(aiter, 0, 3)
            menu[url] = _("View '%(container)s' on SoundCloud") % {
                'container': name
            }

        if len(menu) == 0:
            self.sc_button.set_menu_model(None)
            self.sc_button.set_sensitive(False)
            return None

        m = Gio.Menu()
        for u in menu:
            i = Gio.MenuItem()
            i.set_label(menu[u])
            i.set_action_and_target_value("win.soundcloud-open-uri",
                                          GLib.Variant.new_string(u))
            m.append_item(i)
        self.sc_button.set_menu_model(m)
        self.sc_button.set_sensitive(True)
    def menu_build(self, shell):
        """ Add 'Organize Selection' to the Rhythmbox righ-click menu """
        app = Gio.Application.get_default()

        # create action
        action = Gio.SimpleAction(name="organize-selection")
        action.connect("activate", self.organize_selection)
        app.add_action(action)

        # create menu item
        item = Gio.MenuItem()
        item.set_label("Organize Selection")
        item.set_detailed_action("app.organize-selection")

        # add plugin menu item
        app.add_plugin_menu_item('browser-popup', "Organize Selection", item)
        app.add_action(action)
Example #14
0
	def do_activate(self):
		action = Gio.SimpleAction(name='rhythmbox-sync')
		action.connect('activate', self.sync)

		app = Gio.Application.get_default()
		app.add_action(action)

		menu_item = Gio.MenuItem()
		menu_item.set_label("Sync library with cloud")
		menu_item.set_detailed_action('app.rhythmbox-sync')

		app.add_plugin_menu_item('tools', 'sync-menu-item', menu_item)
		print("Hello World")
		self.connect_signals()
		# entries = [{"artist":"Johnny Vasquez1", "title":"Azafata"}]
		# date = RB.g_date_time_new_now_local()
		# date1 = date.get_julian()
		print("date", self.get_time())
Example #15
0
    def do_activate(self):
        shell = self.object
        self.__db = shell.props.db

        # add a "Update Artist/Title" in "Edit" menu

        self.__action = Gio.SimpleAction(name="songid-update-song")
        self.__action.connect("activate", self.update_song_cb)

        app = Gio.Application.get_default()
        app.add_action(self.__action)

        item = Gio.MenuItem()
        item.set_label(_("Update Artist/Title"))
        item.set_detailed_action('app.songid-update-song')

        app.add_plugin_menu_item('edit', 'songid-update-song', item)
        app.add_plugin_menu_item('browser-popup', 'songid-update-song', item)
Example #16
0
    def do_activate(self):

        shell = self.object
        app = shell.props.application
        self.window = shell.props.window

        #app = Gio.Application.get_default()
        #self.window = self.object.props.window

        self.action = Gio.SimpleAction.new("action_sync_playlist", None)
        self.action.connect("activate", self.do_sync_playlist)
        app.add_action(self.action)

        # add plugin menu item (note the "app." prefix here)
        item = Gio.MenuItem()
        item.set_label('sync playlist')
        item.set_detailed_action('app.action_sync_playlist')
        app.add_plugin_menu_item('playlist-menu', 'sync-playlist',
                                 item)  # display-page-add-playlist
Example #17
0
        def add_app_menuitems(self, ui_string, group_name, menu='tools'):
            """
            utility function to add application menu items.

            For RB2.99 all application menu items are added to the "tools"
            section of the application menu. All Actions are assumed to be of
            action_type "app".

            For RB2.98 or less, it is added however the UI_MANAGER string
            is defined.

            :param ui_string: `str` is the Gtk UI definition.  There is not an
            equivalent UI definition in RB2.99 but we can parse out menu items
            since this string is in XML format

            :param group_name: `str` unique name of the ActionGroup to add menu
            items to
            :param menu: `str` RB2.99 menu section to add to - nominally either
              'tools' or 'view'
            """
            if is_rb3(self.shell):
                root = ET.fromstring(ui_string)
                for elem in root.findall(".//menuitem"):
                    action_name = elem.attrib['action']

                    group = self._action_groups[group_name]
                    act = group.get_action(action_name)

                    item = Gio.MenuItem()
                    item.set_detailed_action('app.' + action_name)
                    item.set_label(act.label)
                    item.set_attribute_value("accel", GLib.Variant("s",
                                                                   act.accel))
                    app = Gio.Application.get_default()
                    index = menu + action_name
                    app.add_plugin_menu_item(menu,
                                             index, item)
                    self._uids[index] = menu
            else:
                uim = self.shell.props.ui_manager
                self._uids.append(uim.add_ui_from_string(ui_string))
                uim.ensure_update()
Example #18
0
    def insert_menu_item(self, menubar, section_name, position, action):
        """
        add a new menu item to the popup
        :param menubar: `str` is the name GtkMenu (or ignored for RB2.99+)
        :param section_name: `str` is the name of the section to add the item
        to (RB2.99+)
        :param position: `int` position to add to GtkMenu (ignored for RB2.99+)
        :param action: `Action`  to associate with the menu item
        """
        label = action.label

        if is_rb3(self.shell):
            app = self.shell.props.application
            item = Gio.MenuItem()
            action.associate_menuitem(item)
            item.set_label(label)

            if section_name not in self._rbmenu_items:
                self._rbmenu_items[section_name] = []
            self._rbmenu_items[section_name].append(label)

            app.add_plugin_menu_item(section_name, label, item)
        else:
            item = Gtk.MenuItem(label=label)
            action.associate_menuitem(item)
            self._rbmenu_items[label] = item
            bar = self.get_menu_object(menubar)

            if position == -1:
                bar.append(item)
            else:
                bar.insert(item, position)
            bar.show_all()
            uim = self.shell.props.ui_manager
            uim.ensure_update()

        return item
Example #19
0
    def __init__(self, th, port, server):
        self.th = th
        self.port = port
        self.server = server  # we need this to quit the server when closing main window
        Gtk.Window.set_default_icon_name('thawab')
        Gtk.Window.__init__(self)
        self.set_title(_('Thawab'))
        self.set_default_size(600, 480)
        self.maximize()
        self.fixes_w = ThFixesWindow(self)
        self.import_w = ThImportWindow(self)
        self.ix_w = ThIndexerWindow(self)

        vb = Gtk.VBox(False, 0)
        self.add(vb)
        ghead = Gtk.HeaderBar()
        ghead.set_show_close_button(True)
        ghead.props.title = _('Thawab')
        self.set_titlebar(ghead)
        tools = Gtk.Toolbar()
        #vb.pack_start(tools, False, False, 2)

        m_button = Gtk.MenuButton()
        ghead.pack_end(m_button)

        m_model = Gio.Menu()
        mi = Gio.MenuItem().new(_("Create search index"), "win.index")
        icon = Gio.ThemedIcon().new("system-run")
        mi.set_icon(icon)
        m_model.append_item(mi)

        mi = Gio.MenuItem().new(_("Misc Fixes"), "win.fixes")
        icon = Gio.ThemedIcon().new("edit-clear")
        mi.set_icon(icon)
        m_model.append_item(mi)

        mi = Gio.MenuItem().new(_("Help"), "win.help")
        icon = Gio.ThemedIcon().new("help-about")
        mi.set_icon(icon)
        m_model.append_item(mi)
        m_button.set_menu_model(m_model)

        m_action = Gio.SimpleAction.new("index", None)
        m_action.connect("activate", lambda *a: self.ix_w.show_all())
        self.add_action(m_action)
        m_action = Gio.SimpleAction.new("fixes", None)
        m_action.connect("activate", self.fixes_cb)
        self.add_action(m_action)
        m_action = Gio.SimpleAction.new("help", None)
        m_action.connect(
            "activate", lambda *a: self._content.new_tab(
                "http://127.0.0.1:%d/_theme/manual/manual.html" % port))
        self.add_action(m_action)

        self.axl = Gtk.AccelGroup()
        self.add_accel_group(self.axl)
        ACCEL_CTRL_KEY, ACCEL_CTRL_MOD = Gtk.accelerator_parse("<Ctrl>")
        ACCEL_SHFT_KEY, ACCEL_SHFT_MOD = Gtk.accelerator_parse("<Shift>")
        img = Gtk.Image()
        img.set_from_stock(Gtk.STOCK_ZOOM_IN, Gtk.IconSize.BUTTON)
        b = Gtk.ToolButton(icon_widget=img, label=_("Zoom in"))
        b.add_accelerator("clicked", self.axl, Gdk.KEY_equal, ACCEL_CTRL_MOD,
                          Gtk.AccelFlags.VISIBLE)
        b.add_accelerator("clicked", self.axl, Gdk.KEY_plus, ACCEL_CTRL_MOD,
                          Gtk.AccelFlags.VISIBLE)
        b.add_accelerator("clicked", self.axl, Gdk.KEY_KP_Add, ACCEL_CTRL_MOD,
                          Gtk.AccelFlags.VISIBLE)
        b.set_is_important(True)
        b.set_tooltip_text("{}\t‪{}‬".format(_("Makes things appear bigger"),
                                             "(Ctrl++)"))
        b.connect('clicked', lambda a: self._do_in_current_view("zoom_in"))
        ghead.pack_end(b)

        img = Gtk.Image()
        img.set_from_stock(Gtk.STOCK_ZOOM_100, Gtk.IconSize.BUTTON)
        b = Gtk.ToolButton(icon_widget=img, label=_("1:1 Zoom"))
        b.add_accelerator("clicked", self.axl, ord('0'), ACCEL_CTRL_MOD,
                          Gtk.AccelFlags.VISIBLE)
        b.add_accelerator("clicked", self.axl, Gdk.KEY_KP_0, ACCEL_CTRL_MOD,
                          Gtk.AccelFlags.VISIBLE)
        b.set_tooltip_text("{}\t{}".format(_("Restore original zoom factor"),
                                           "(Ctrl+0)"))
        b.connect('clicked',
                  lambda a: self._do_in_current_view("set_zoom_level", 1.0))
        ghead.pack_end(b)

        img = Gtk.Image()
        img.set_from_stock(Gtk.STOCK_ZOOM_OUT, Gtk.IconSize.BUTTON)
        b = Gtk.ToolButton(icon_widget=img, label=_("Zoom out"))
        b.add_accelerator("clicked", self.axl, Gdk.KEY_minus, ACCEL_CTRL_MOD,
                          Gtk.AccelFlags.VISIBLE)
        b.add_accelerator("clicked", self.axl, Gdk.KEY_KP_Subtract,
                          ACCEL_CTRL_MOD, Gtk.AccelFlags.VISIBLE)
        b.set_tooltip_text("{}\t‪{}‬".format(_("Makes things appear smaller"),
                                             "(Ctrl+-)"))
        b.connect('clicked', lambda a: self._do_in_current_view("zoom_out"))
        ghead.pack_end(b)

        self._content = ContentPane("http://127.0.0.1:%d/" % port, _("Thawab"))
        vb.pack_start(self._content, True, True, 0)

        b = Gtk.ToolButton.new_from_stock(Gtk.STOCK_NEW)
        b.connect('clicked', lambda bb: self._content.new_tab())
        b.add_accelerator("clicked", self.axl, ord('n'), ACCEL_CTRL_MOD,
                          Gtk.AccelFlags.VISIBLE)
        b.set_tooltip_text("{}\t‪{}‬".format(_("Open a new tab"), "(Ctrl+N)"))
        #tools.insert(b, -1)
        ghead.pack_start(b)

        # TODO: add navigation buttons (back, forward ..etc.) and zoom buttons
        tools.insert(Gtk.SeparatorToolItem(), -1)

        img = Gtk.Image()
        img.set_from_stock(Gtk.STOCK_CONVERT, Gtk.IconSize.BUTTON)
        b = Gtk.ToolButton.new(icon_widget=img, label=_("Import"))
        b.set_tooltip_text(_("Import .bok files"))
        b.connect('clicked', self.import_cb)
        #tools.insert(b, -1)
        ghead.pack_start(b)

        img = Gtk.Image()
        img.set_from_stock(Gtk.STOCK_FIND_AND_REPLACE, Gtk.IconSize.BUTTON)
        b = Gtk.ToolButton(icon_widget=img, label=_("Index"))
        b.set_is_important(True)
        b.set_tooltip_text(_("Create search index"))
        b.connect('clicked', lambda *a: self.ix_w.show_all())
        tools.insert(b, -1)

        tools.insert(Gtk.SeparatorToolItem(), -1)

        tools.insert(Gtk.SeparatorToolItem(), -1)

        img = Gtk.Image()
        img.set_from_stock(Gtk.STOCK_PREFERENCES, Gtk.IconSize.BUTTON)
        b = Gtk.ToolButton(icon_widget=img, label=_("Fixes"))
        b.set_is_important(True)
        b.set_tooltip_text(_("Misc Fixes"))
        b.connect('clicked', self.fixes_cb)
        tools.insert(b, -1)

        tools.insert(Gtk.SeparatorToolItem(), -1)

        img = Gtk.Image()
        img.set_from_stock(Gtk.STOCK_HELP, Gtk.IconSize.BUTTON)
        b = Gtk.ToolButton(icon_widget=img, label=_("Help"))
        b.set_tooltip_text(_("Show user manual"))
        b.connect(
            'clicked', lambda a: self._content.new_tab(
                "http://127.0.0.1:%d/_theme/manual/manual.html" % port))
        tools.insert(b, -1)

        self._content.new_tab()

        self.connect("delete_event", self.quit)
        self.connect("destroy", self.quit)
        ## prepare dnd
        self.drag_dest_set(Gtk.DestDefaults.ALL, [], Gdk.DragAction.COPY)
        self.drag_dest_set_target_list(targets)
        self.connect('drag-data-received', self.drop_data_cb)

        self.show_all()
Example #20
0
	def setup(self):
		shell = self.props.shell

		builder = Gtk.Builder()
		builder.add_from_file(rb.find_plugin_file(self.props.plugin, "soundcloud.ui"))

		self.scrolled = builder.get_object("container-scrolled")
		self.scrolled.set_no_show_all(True)
		self.scrolled.hide()

		self.more_containers_idle = 0
		adj = self.scrolled.get_vadjustment()
		adj.connect("changed", self.scroll_adjust_changed_cb)
		adj.connect("value-changed", self.scroll_adjust_changed_cb)

		self.search_entry = RB.SearchEntry(spacing=6)
		self.search_entry.props.explicit_mode = True

		self.fetch_more_button = Gtk.Button.new_with_label(_("Fetch more tracks"))
		self.fetch_more_button.connect("clicked", self.show_more_cb)

		action = Gio.SimpleAction.new("soundcloud-search-type", GLib.VariantType.new('s'))
		action.connect("activate", self.search_type_action_cb)
		shell.props.window.add_action(action)

		m = Gio.Menu()
		for st in sorted(self.search_types):
			i = Gio.MenuItem()
			i.set_label(self.search_types[st]['label'])
			i.set_action_and_target_value("win.soundcloud-search-type", GLib.Variant.new_string(st))
			m.append_item(i)

		self.search_popup = Gtk.Menu.new_from_model(m)

		action.activate(GLib.Variant.new_string("tracks"))

		grid = builder.get_object("soundcloud-source")

		self.search_entry.connect("search", self.search_entry_cb)
		self.search_entry.connect("activate", self.search_entry_cb)
		self.search_entry.connect("show-popup", self.search_popup_cb)
		self.search_entry.set_size_request(400, -1)

		searchbox = builder.get_object("search-box")
		searchbox.pack_start(self.search_entry, False, True, 0)
		searchbox.pack_start(self.fetch_more_button, False, True, 0)


		self.search_popup.attach_to_widget(self.search_entry, None)

		self.containers = builder.get_object("container-store")
		self.container_view = builder.get_object("containers")
		self.container_view.set_model(self.containers)

		action = Gio.SimpleAction.new("soundcloud-open-uri", GLib.VariantType.new('s'))
		action.connect("activate", self.open_uri_action_cb)
		shell.props.window.add_action(action)

		r = Gtk.CellRendererText()
		c = Gtk.TreeViewColumn("", r, text=0)
		self.container_view.append_column(c)

		self.container_view.get_selection().connect('changed', self.selection_changed_cb)

		self.songs = RB.EntryView(db=shell.props.db,
					  shell_player=shell.props.shell_player,
					  is_drag_source=True,
					  is_drag_dest=False,
					  shadow_type=Gtk.ShadowType.NONE)
		self.songs.append_column(RB.EntryViewColumn.TITLE, True)
		self.songs.append_column(RB.EntryViewColumn.ARTIST, True)
		self.songs.append_column(RB.EntryViewColumn.DURATION, True)
		self.songs.append_column(RB.EntryViewColumn.YEAR, False)
		self.songs.append_column(RB.EntryViewColumn.GENRE, False)
		self.songs.append_column(RB.EntryViewColumn.BPM, False)
		self.songs.append_column(RB.EntryViewColumn.FIRST_SEEN, False)
		self.songs.set_model(self.props.query_model)
		self.songs.connect("notify::sort-order", self.sort_order_changed_cb)
		self.songs.connect("selection-changed", self.songs_selection_changed_cb)

		paned = builder.get_object("paned")
		paned.pack2(self.songs)

		self.bind_settings(self.songs, paned, None, True)

		self.sc_button = Gtk.MenuButton()
		self.sc_button.set_relief(Gtk.ReliefStyle.NONE)
		img = Gtk.Image.new_from_file(rb.find_plugin_file(self.props.plugin, "powered-by-soundcloud.png"))
		self.sc_button.add(img)
		box = builder.get_object("soundcloud-button-box")
		box.pack_start(self.sc_button, True, True, 0)

		self.build_sc_menu()

		self.pack_start(grid, expand=True, fill=True, padding=0)
		grid.show_all()

		self.art_store = RB.ExtDB(name="album-art")
		player = shell.props.shell_player
		player.connect('playing-song-changed', self.playing_entry_changed_cb)