Exemplo n.º 1
0
    def _refresh_copy_palette(self):
        palette = self._copy.get_palette()

        for menu_item in palette.menu.get_children():
            palette.menu.remove(menu_item)
            menu_item.destroy()

        clipboard_menu = ClipboardMenu(self._metadata)
        clipboard_menu.set_image(
            Icon(icon_name='toolbar-edit', icon_size=Gtk.IconSize.MENU))
        clipboard_menu.connect('volume-error', self.__volume_error_cb)
        palette.menu.append(clipboard_menu)
        clipboard_menu.show()

        if self._metadata['mountpoint'] != '/':
            client = GConf.Client.get_default()
            color = XoColor(client.get_string('/desktop/sugar/user/color'))
            journal_menu = VolumeMenu(self._metadata, _('Journal'), '/')
            journal_menu.set_image(
                Icon(icon_name='activity-journal',
                     xo_color=color,
                     icon_size=Gtk.IconSize.MENU))
            journal_menu.connect('volume-error', self.__volume_error_cb)
            palette.menu.append(journal_menu)
            journal_menu.show()

        documents_path = model.get_documents_path()
        if documents_path is not None and not \
                self._metadata['uid'].startswith(documents_path):
            documents_menu = VolumeMenu(self._metadata, _('Documents'),
                                        documents_path)
            documents_menu.set_image(
                Icon(icon_name='user-documents', icon_size=Gtk.IconSize.MENU))
            documents_menu.connect('volume-error', self.__volume_error_cb)
            palette.menu.append(documents_menu)
            documents_menu.show()

        volume_monitor = Gio.VolumeMonitor.get()
        icon_theme = Gtk.IconTheme.get_default()
        for mount in volume_monitor.get_mounts():
            if self._metadata['mountpoint'] == mount.get_root().get_path():
                continue
            volume_menu = VolumeMenu(self._metadata, mount.get_name(),
                                     mount.get_root().get_path())
            for name in mount.get_icon().props.names:
                if icon_theme.has_icon(name):
                    volume_menu.set_image(
                        Icon(icon_name=name, icon_size=Gtk.IconSize.MENU))
                    break
            volume_menu.connect('volume-error', self.__volume_error_cb)
            palette.menu.append(volume_menu)
            volume_menu.show()
Exemplo n.º 2
0
    def _refresh_copy_palette(self):
        palette = self._copy.get_palette()

        for menu_item in palette.menu.get_children():
            palette.menu.remove(menu_item)
            menu_item.destroy()

        clipboard_menu = ClipboardMenu(self._metadata)
        clipboard_menu.set_image(Icon(icon_name='toolbar-edit',
                                      icon_size=Gtk.IconSize.MENU))
        clipboard_menu.connect('volume-error', self.__volume_error_cb)
        palette.menu.append(clipboard_menu)
        clipboard_menu.show()

        if self._metadata['mountpoint'] != '/':
            client = GConf.Client.get_default()
            color = XoColor(client.get_string('/desktop/sugar/user/color'))
            journal_menu = VolumeMenu(self._metadata, _('Journal'), '/')
            journal_menu.set_image(Icon(icon_name='activity-journal',
                                        xo_color=color,
                                        icon_size=Gtk.IconSize.MENU))
            journal_menu.connect('volume-error', self.__volume_error_cb)
            palette.menu.append(journal_menu)
            journal_menu.show()

        documents_path = model.get_documents_path()
        if documents_path is not None and not \
                self._metadata['uid'].startswith(documents_path):
            documents_menu = VolumeMenu(self._metadata, _('Documents'),
                                        documents_path)
            documents_menu.set_image(Icon(icon_name='user-documents',
                                          icon_size=Gtk.IconSize.MENU))
            documents_menu.connect('volume-error', self.__volume_error_cb)
            palette.menu.append(documents_menu)
            documents_menu.show()

        volume_monitor = Gio.VolumeMonitor.get()
        icon_theme = Gtk.IconTheme.get_default()
        for mount in volume_monitor.get_mounts():
            if self._metadata['mountpoint'] == mount.get_root().get_path():
                continue
            volume_menu = VolumeMenu(self._metadata, mount.get_name(),
                                     mount.get_root().get_path())
            for name in mount.get_icon().props.names:
                if icon_theme.has_icon(name):
                    volume_menu.set_image(Icon(icon_name=name,
                                               icon_size=Gtk.IconSize.MENU))
                    break
            volume_menu.connect('volume-error', self.__volume_error_cb)
            palette.menu.append(volume_menu)
            volume_menu.show()

        for account in accountsmanager.get_configured_accounts():
            menu = account.get_share_menu(self._metadata)
            palette.menu.append(menu)
Exemplo n.º 3
0
    def _refresh_copy_palette(self):
        palette = self._copy.get_palette()

        for menu_item in palette.menu.get_children():
            palette.menu.remove(menu_item)
            menu_item.destroy()

        clipboard_menu = ClipboardMenu(self._metadata)
        clipboard_menu.set_image(
            Icon(icon_name='toolbar-edit', icon_size=gtk.ICON_SIZE_MENU))
        clipboard_menu.connect('volume-error', self.__volume_error_cb)
        palette.menu.append(clipboard_menu)
        clipboard_menu.show()

        if self._metadata['mountpoint'] != '/':
            client = gconf.client_get_default()
            color = XoColor(client.get_string('/desktop/sugar/user/color'))
            journal_menu = VolumeMenu(self._metadata, _('Journal'), '/')
            journal_menu.set_image(
                Icon(icon_name='activity-journal',
                     xo_color=color,
                     icon_size=gtk.ICON_SIZE_MENU))
            journal_menu.connect('volume-error', self.__volume_error_cb)
            palette.menu.append(journal_menu)
            journal_menu.show()

        volume_monitor = gio.volume_monitor_get()
        icon_theme = gtk.icon_theme_get_default()
        for mount in volume_monitor.get_mounts():
            if self._metadata['mountpoint'] == mount.get_root().get_path():
                continue
            volume_menu = VolumeMenu(self._metadata, mount.get_name(),
                                     mount.get_root().get_path())
            for name in mount.get_icon().props.names:
                if icon_theme.has_icon(name):
                    volume_menu.set_image(
                        Icon(icon_name=name, icon_size=gtk.ICON_SIZE_MENU))
                    break
            volume_menu.connect('volume-error', self.__volume_error_cb)
            palette.menu.append(volume_menu)
            volume_menu.show()
Exemplo n.º 4
0
    def _refresh_copy_palette(self):
        palette = self._copy.get_palette()

        for menu_item in palette.menu.get_children():
            palette.menu.remove(menu_item)
            menu_item.destroy()

        clipboard_menu = ClipboardMenu(self._metadata)
        clipboard_menu.set_image(Icon(icon_name='toolbar-edit',
                                      icon_size=gtk.ICON_SIZE_MENU))
        clipboard_menu.connect('volume-error', self.__volume_error_cb)
        palette.menu.append(clipboard_menu)
        clipboard_menu.show()

        if self._metadata['mountpoint'] != '/':
            client = gconf.client_get_default()
            color = XoColor(client.get_string('/desktop/sugar/user/color'))
            journal_menu = VolumeMenu(self._metadata, _('Journal'), '/')
            journal_menu.set_image(Icon(icon_name='activity-journal',
                                        xo_color=color,
                                        icon_size=gtk.ICON_SIZE_MENU))
            journal_menu.connect('volume-error', self.__volume_error_cb)
            palette.menu.append(journal_menu)
            journal_menu.show()

        volume_monitor = gio.volume_monitor_get()
        icon_theme = gtk.icon_theme_get_default()
        for mount in volume_monitor.get_mounts():
            if self._metadata['mountpoint'] == mount.get_root().get_path():
                continue
            volume_menu = VolumeMenu(self._metadata, mount.get_name(),
                                     mount.get_root().get_path())
            for name in mount.get_icon().props.names:
                if icon_theme.has_icon(name):
                    volume_menu.set_image(Icon(icon_name=name,
                                               icon_size=gtk.ICON_SIZE_MENU))
                    break
            volume_menu.connect('volume-error', self.__volume_error_cb)
            palette.menu.append(volume_menu)
            volume_menu.show()