Exemple #1
0
    def __init__(self, handler):
        """
        constructor

        handler -- a e3common.Handler.GroupHandler
        """
        gtk.Menu.__init__(self)
        self.handler = handler

        add = gtk.ImageMenuItem(gtk.STOCK_ADD)
        add.connect("activate", lambda *args: handler.on_add_group_selected())

        remove = gtk.ImageMenuItem(gtk.STOCK_REMOVE)
        remove.connect("activate", lambda *args: handler.on_remove_group_selected())

        rename = gtk.ImageMenuItem(_("Rename"))
        rename.set_image(gtk.image_new_from_stock(gtk.STOCK_EDIT, gtk.ICON_SIZE_MENU))
        rename.connect("activate", lambda *args: handler.on_rename_group_selected())

        self.set_favorite = gtk.ImageMenuItem(_("Set as favorite"))
        self.set_favorite.set_image(utils.gtk_ico_image_load(gui.theme.image_theme.favorite, gtk.ICON_SIZE_MENU))
        self.set_favorite.connect("activate", lambda *args: self.on_favorite_group_selected())

        self.unset_favorite = gtk.ImageMenuItem(_("Unset as favorite"))
        self.unset_favorite.set_image(gtk.image_new_from_stock(gtk.STOCK_CANCEL, gtk.ICON_SIZE_MENU))
        self.unset_favorite.connect("activate", lambda *args: self.on_unset_favorite_group_selected())

        self.update_items()

        self.append(add)
        self.append(remove)
        self.append(rename)
        self.append(self.set_favorite)
        self.append(self.unset_favorite)
Exemple #2
0
    def __init__(self, handler, session):
        """
        constructor

        handler -- a e3common.Handler.GroupHandler
        """
        gtk.Menu.__init__(self)
        self.handler = handler

        self.add = gtk.ImageMenuItem(gtk.STOCK_ADD)
        self.add.connect('activate', 
            lambda *args: self.handler.on_add_group_selected())

        self.remove = gtk.ImageMenuItem(gtk.STOCK_REMOVE)
        self.remove.connect('activate', 
            lambda *args: self.handler.on_remove_group_selected())

        self.rename = gtk.ImageMenuItem(_('Rename'))
        self.rename.set_image(gtk.image_new_from_stock(gtk.STOCK_EDIT,
            gtk.ICON_SIZE_MENU))
        self.rename.connect('activate', 
            lambda *args: self.handler.on_rename_group_selected())


        self.set_favorite = gtk.ImageMenuItem(_('Set as favorite'))
        self.set_favorite.set_image(utils.gtk_ico_image_load(gui.theme.image_theme.favorite,
                                                             gtk.ICON_SIZE_MENU))
        self.set_favorite.connect('activate', 
                              lambda *args: self.on_favorite_group_selected())
        
        
        self.unset_favorite = gtk.ImageMenuItem(_('Unset as favorite'))
        self.unset_favorite.set_image(gtk.image_new_from_stock(gtk.STOCK_CANCEL,
                                                               gtk.ICON_SIZE_MENU))
        self.unset_favorite.connect('activate', 
                              lambda *args: self.on_unset_favorite_group_selected())
        
        if self.handler.contact_list.is_favorite_group_selected():
            self.show_unset_favorite_item()
        else:
            self.show_set_favorite_item()

        if session.session_has_service(e3.Session.SERVICE_GROUP_MANAGING):
            self.append(self.add)
            self.append(self.remove)
            self.append(self.rename)
        self.append(self.set_favorite)
        self.append(self.unset_favorite)
Exemple #3
0
    def __init__(self, handler):
        """
        constructor

        handler -- a e3common.Handler.GroupHandler
        """
        gtk.Menu.__init__(self)
        self.handler = handler

        self.add = gtk.ImageMenuItem(gtk.STOCK_ADD)
        self.add.connect('activate', 
            lambda *args: self.handler.on_add_group_selected())

        self.remove = gtk.ImageMenuItem(gtk.STOCK_REMOVE)
        self.remove.connect('activate', 
            lambda *args: self.handler.on_remove_group_selected())

        self.rename = gtk.ImageMenuItem(_('Rename'))
        self.rename.set_image(gtk.image_new_from_stock(gtk.STOCK_EDIT,
            gtk.ICON_SIZE_MENU))
        self.rename.connect('activate', 
            lambda *args: self.handler.on_rename_group_selected())


        self.set_favorite = gtk.ImageMenuItem(_('Set as favorite'))
        self.set_favorite.set_image(utils.gtk_ico_image_load(gui.theme.image_theme.favorite,
                                                             gtk.ICON_SIZE_MENU))
        self.set_favorite.connect('activate', 
                              lambda *args: self.on_favorite_group_selected())
        
        
        self.unset_favorite = gtk.ImageMenuItem(_('Unset as favorite'))
        self.unset_favorite.set_image(gtk.image_new_from_stock(gtk.STOCK_CANCEL,
                                                               gtk.ICON_SIZE_MENU))
        self.unset_favorite.connect('activate', 
                              lambda *args: self.on_unset_favorite_group_selected())
        
        if self.handler.contact_list.is_favorite_group_selected():
            self.show_unset_favorite_item()
        else:
            self.show_set_favorite_item()

        self.append(self.add)
        self.append(self.remove)
        self.append(self.rename)
        self.append(self.set_favorite)
        self.append(self.unset_favorite)
Exemple #4
0
    def draw(self):
        '''draw the toolbar'''
        toolbar_small = self.handler.session.config.get_or_set(
            'b_toolbar_small', False)

        if toolbar_small:
            size = gtk.ICON_SIZE_MENU
        else:
            size = gtk.ICON_SIZE_LARGE_TOOLBAR

        settings = self.get_settings()
        settings.set_long_property('gtk-toolbar-icon-size', size,
                                   'ConversationToolbar.py:37')

        # check if we have theme-specific toolbar-icons

        image_theme = gui.theme.image_theme
        if image_theme.has_custom_toolbar_icons():
            theme_tool_font = utils.gtk_ico_image_load(image_theme.tool_font,
                                                       size)
            theme_tool_font_color = utils.gtk_ico_image_load(
                image_theme.tool_font_color, size)
            theme_tool_emotes = utils.gtk_ico_image_load(
                image_theme.tool_emotes, size)
            theme_tool_nudge = utils.gtk_ico_image_load(
                image_theme.tool_nudge, size)
            theme_tool_invite = utils.gtk_ico_image_load(
                image_theme.tool_invite, size)
            theme_tool_clean = utils.gtk_ico_image_load(
                image_theme.tool_clean, size)
            theme_tool_file_transfer = utils.gtk_ico_image_load(
                image_theme.tool_file_transfer, size)
            self.theme_tool_block = utils.gtk_ico_image_load(
                image_theme.tool_block, size)
            self.theme_tool_unblock = utils.gtk_ico_image_load(
                image_theme.tool_unblock, size)
        else:
            theme_tool_font = gtk.STOCK_SELECT_FONT
            theme_tool_font_color = gtk.STOCK_SELECT_COLOR

            emote_theme = gui.theme.emote_theme

            theme_tool_emotes = utils.gtk_ico_image_load(
                emote_theme.emote_to_path(':D', True), size)
            theme_tool_nudge = utils.gtk_ico_image_load(
                emote_theme.emote_to_path(':S', True), size)
            theme_tool_invite = gtk.STOCK_ADD
            theme_tool_clean = gtk.STOCK_CLEAR
            theme_tool_file_transfer = gtk.STOCK_GO_UP
            self.theme_tool_block = gtk.STOCK_STOP
            self.theme_tool_unblock = gtk.STOCK_YES

        if self.session.config.b_avatar_on_left:
            self.theme_tool_hide_avatar = gtk.STOCK_GO_BACK
            self.theme_tool_show_avatar = gtk.STOCK_GO_FORWARD
        else:
            self.theme_tool_hide_avatar = gtk.STOCK_GO_FORWARD
            self.theme_tool_show_avatar = gtk.STOCK_GO_BACK

        theme_tool_call = utils.gtk_ico_image_load(image_theme.call, size)
        theme_tool_video = utils.gtk_ico_image_load(image_theme.video, size)
        theme_tool_av = utils.gtk_ico_image_load(image_theme.av, size)

        self.font = gtk.ToolButton(theme_tool_font)
        self.font.set_label(_('Select font'))
        self.font.set_tooltip_text(_('Select font'))
        self.font.connect('clicked',
                          lambda *args: self.handler.on_font_selected())

        self.color = gtk.ToolButton(theme_tool_font_color)
        self.color.set_label(_('Select font color'))
        self.color.set_tooltip_text(_('Select font color'))
        self.color.connect('clicked',
                           lambda *args: self.handler.on_color_selected())

        self.emotes = gtk.ToolButton()
        self.emotes.set_icon_widget(theme_tool_emotes)
        self.emotes.set_label(_('Send an emoticon'))
        self.emotes.set_tooltip_text(_('Send an emoticon'))
        self.emotes.connect('clicked',
                            lambda *args: self.handler.on_emotes_selected())

        self.nudge = gtk.ToolButton()
        self.nudge.set_icon_widget(theme_tool_nudge)
        self.nudge.set_label(_('Request attention'))
        self.nudge.set_tooltip_text(_('Request attention'))
        self.nudge.connect(
            'clicked',
            lambda *args: self.handler.on_notify_attention_selected())

        self.invite = gtk.ToolButton(theme_tool_invite)
        self.invite.set_label(_('Invite a buddy'))
        self.invite.set_tooltip_text(_('Invite a buddy'))
        self.invite.connect('clicked',
                            lambda *args: self.handler.on_invite_selected())

        self.clean = gtk.ToolButton(theme_tool_clean)
        self.clean.set_label(_('Clean the conversation'))
        self.clean.set_tooltip_text(_('Clean the conversation'))
        self.clean.connect('clicked',
                           lambda *args: self.handler.on_clean_selected())

        self.invite_file_transfer = gtk.ToolButton(theme_tool_file_transfer)
        self.invite_file_transfer.set_label(_('Send a file'))
        self.invite_file_transfer.set_tooltip_text(_('Send a file'))
        self.invite_file_transfer.connect(
            'clicked',
            lambda *args: self.handler.on_invite_file_transfer_selected())

        self.ublock = gtk.ToolButton(self.theme_tool_block)
        self.ublock.set_label(_('Block/Unblock contact'))
        self.ublock.set_tooltip_text(_('Block/Unblock contact'))
        self.ublock.connect('clicked',
                            lambda *args: self.handler.on_ublock_selected())

        self.toggle_avatar = gtk.ToolButton(self.theme_tool_show_avatar)
        self.toggle_avatar.set_label(_('Hide/Show avatar'))
        self.update_toggle_avatar_icon(self.session.config.b_show_info)
        self.toggle_avatar.connect(
            'clicked', lambda *args: self.handler.on_toggle_avatar_selected())

        self.invite_video_call = gtk.ToolButton(theme_tool_video)
        self.invite_video_call.set_label(_('Video Call'))
        self.invite_video_call.set_tooltip_text(_('Video Call'))
        self.invite_video_call.connect(
            'clicked',
            lambda *args: self.handler.on_invite_video_call_selected())

        self.invite_audio_call = gtk.ToolButton(theme_tool_call)
        self.invite_audio_call.set_label(_('Voice Call'))
        self.invite_audio_call.set_tooltip_text(_('Voice Call'))
        self.invite_audio_call.connect(
            'clicked',
            lambda *args: self.handler.on_invite_voice_call_selected())

        self.invite_av_call = gtk.ToolButton(theme_tool_av)
        self.invite_av_call.set_label(_('Audio/Video Call'))
        self.invite_av_call.set_tooltip_text(_('Audio/Video Call'))
        self.invite_av_call.connect(
            'clicked', lambda *args: self.handler.on_invite_av_call_selected())

        self.add(self.font)
        self.add(self.color)
        self.add(gtk.SeparatorToolItem())

        self.add(self.emotes)
        self.add(self.nudge)

        if self.handler.session_service_supported(
                e3.Session.SERVICE_CONTACT_INVITE):
            self.add(gtk.SeparatorToolItem())
            self.add(self.invite)
        if self.handler.session_service_supported(
                e3.Session.SERVICE_FILETRANSFER):
            self.add(self.invite_file_transfer)
        self.add(gtk.SeparatorToolItem())

        if self.handler.session_service_supported(e3.Session.SERVICE_CALLS):
            self.add(self.invite_video_call)
            self.add(self.invite_audio_call)
            self.add(self.invite_av_call)
            self.add(gtk.SeparatorToolItem())

        self.add(self.clean)
        if self.handler.session_service_supported(
                e3.Session.SERVICE_CONTACT_BLOCK):
            self.add(self.ublock)
        self.add(gtk.SeparatorToolItem())
        self.add(self.toggle_avatar)
    def draw(self):
        '''draw the toolbar'''
        toolbar_small = self.handler.session.config.get_or_set('b_toolbar_small', False)

        if toolbar_small:
            size = gtk.ICON_SIZE_MENU
        else:
            size = gtk.ICON_SIZE_LARGE_TOOLBAR

        whsize = gtk.icon_size_lookup(size)

        self.settings = self.get_settings()
        self.settings.set_long_property('gtk-toolbar-icon-size', size, \
            'ConversationToolbar.py:37')

        # check if we have theme-specific toolbar-icons

        image_theme = gui.theme.get_image_theme()
        if image_theme.has_custom_toolbar_icons():
            theme_tool_font = utils.gtk_ico_image_load(image_theme.tool_font, size)
            theme_tool_font_color = utils.gtk_ico_image_load(image_theme.tool_font_color, size)
            theme_tool_emotes = utils.gtk_ico_image_load(image_theme.tool_emotes, size)
            theme_tool_nudge = utils.gtk_ico_image_load(image_theme.tool_nudge, size)
            theme_tool_invite = utils.gtk_ico_image_load(image_theme.tool_invite, size)
            theme_tool_clean = utils.gtk_ico_image_load(image_theme.tool_clean, size)
            theme_tool_file_transfer = utils.gtk_ico_image_load(image_theme.tool_file_transfer, size)
            theme_tool_ublock = utils.gtk_ico_image_load(image_theme.tool_ublock, size)
        else:
            theme_tool_font = gtk.STOCK_SELECT_FONT
            theme_tool_font_color = gtk.STOCK_SELECT_COLOR

            emote_theme = gui.theme.get_emote_theme()

            theme_tool_emotes = utils.gtk_ico_image_load(emote_theme.emote_to_path(':D', True), size)
            theme_tool_nudge = utils.gtk_ico_image_load(emote_theme.emote_to_path(':S', True), size)
            theme_tool_invite = gtk.STOCK_ADD
            theme_tool_clean = gtk.STOCK_CLEAR
            theme_tool_file_transfer = gtk.STOCK_GO_UP
            theme_tool_ublock = gtk.STOCK_STOP

        theme_tool_call = utils.gtk_ico_image_load(image_theme.call, size)
        theme_tool_video = utils.gtk_ico_image_load(image_theme.video, size)
        theme_tool_av = utils.gtk_ico_image_load(image_theme.av, size)

        self.font = gtk.ToolButton(theme_tool_font)
        self.font.set_label(_('Select font'))
        self.font.set_tooltip_text(_('Select font')) 
        self.font.connect('clicked',
            lambda *args: self.handler.on_font_selected())

        self.color = gtk.ToolButton(theme_tool_font_color)
        self.color.set_label(_('Select font color'))
        self.color.set_tooltip_text(_('Select font color')) 
        self.color.connect('clicked',
            lambda *args: self.handler.on_color_selected())

        self.emotes = gtk.ToolButton(theme_tool_emotes)
        self.emotes.set_label(_('Send an emoticon'))
        self.emotes.set_tooltip_text(_('Send an emoticon')) 
        self.emotes.connect('clicked',
            lambda *args: self.handler.on_emotes_selected())

        self.nudge = gtk.ToolButton(theme_tool_nudge)
        self.nudge.set_label(_('Request attention'))
        self.nudge.set_tooltip_text(_('Request attention')) 
        self.nudge.connect('clicked',
            lambda *args: self.handler.on_notify_attention_selected())

        self.invite = gtk.ToolButton(theme_tool_invite)
        self.invite.set_label(_('Invite a buddy'))
        self.invite.set_tooltip_text(_('Invite a buddy')) 
        self.invite.connect('clicked',
            lambda *args: self.handler.on_invite_selected())

        self.clean = gtk.ToolButton(theme_tool_clean)
        self.clean.set_label(_('Clean the conversation'))
        self.clean.set_tooltip_text(_('Clean the conversation')) 
        self.clean.connect('clicked',
            lambda *args: self.handler.on_clean_selected())

        self.invite_file_transfer = gtk.ToolButton(theme_tool_file_transfer)
        self.invite_file_transfer.set_label(_('Send a file'))
        self.invite_file_transfer.set_tooltip_text(_('Send a file')) 
        self.invite_file_transfer.connect('clicked',
            lambda *args: self.handler.on_invite_file_transfer_selected())

        self.ublock = gtk.ToolButton(theme_tool_ublock)
        self.ublock.set_label(_('Block/Unblock contact'))
        self.ublock.set_tooltip_text(_('Block/Unblock contact')) 
        self.ublock.connect('clicked',
            lambda *args: self.handler.on_ublock_selected())

        self.invite_video_call = gtk.ToolButton(theme_tool_video)
        self.invite_video_call.set_label(_('Video Call'))
        self.invite_video_call.set_tooltip_text(_('Video Call')) 
        self.invite_video_call.connect('clicked',
            lambda *args: self.handler.on_invite_video_call_selected())

        self.invite_audio_call = gtk.ToolButton(theme_tool_call)
        self.invite_audio_call.set_label(_('Voice Call'))
        self.invite_audio_call.set_tooltip_text(_('Voice Call')) 
        self.invite_audio_call.connect('clicked',
            lambda *args: self.handler.on_invite_voice_call_selected())

        self.invite_av_call = gtk.ToolButton(theme_tool_av)
        self.invite_av_call.set_label(_('Audio/Video Call'))
        self.invite_av_call.set_tooltip_text(_('Audio/Video Call')) 
        self.invite_av_call.connect('clicked',
            lambda *args: self.handler.on_invite_av_call_selected())

        self.add(self.font)
        self.add(self.color)
        self.add(gtk.SeparatorToolItem())

        self.add(self.emotes)
        self.add(self.nudge)
        self.add(gtk.SeparatorToolItem())

        self.add(self.invite)
        if self.handler.session_filetransfer_supported():
            self.add(self.invite_file_transfer)
        self.add(gtk.SeparatorToolItem())

        if self.handler.session_call_supported():
            self.add(self.invite_video_call)
            self.add(self.invite_audio_call)
            self.add(self.invite_av_call)
            self.add(gtk.SeparatorToolItem())

        self.add(self.clean)
        self.add(self.ublock)
        self.add(gtk.SeparatorToolItem())
    def draw(self):
        '''draw the toolbar'''
        toolbar_small = self.handler.session.config.get_or_set('b_toolbar_small', False)

        if toolbar_small:
            size = gtk.ICON_SIZE_MENU
        else:
            size = gtk.ICON_SIZE_LARGE_TOOLBAR

        whsize = gtk.icon_size_lookup(size)

        self.settings = self.get_settings()
        self.settings.set_long_property('gtk-toolbar-icon-size', size, \
            'ConversationToolbar.py:37')

        # check if we have theme-specific toolbar-icons

        if gui.theme.toolbar_path:
            theme_tool_font = utils.gtk_ico_image_load(gui.theme.tool_font, size)
            theme_tool_font_color = utils.gtk_ico_image_load(gui.theme.tool_font_color, size)
            theme_tool_emotes = utils.gtk_ico_image_load(gui.theme.tool_emotes, size)
            theme_tool_nudge = utils.gtk_ico_image_load(gui.theme.tool_nudge, size)
            theme_tool_invite = utils.gtk_ico_image_load(gui.theme.tool_invite, size)
            theme_tool_clean = utils.gtk_ico_image_load(gui.theme.tool_clean, size)
            theme_tool_file_transfer = utils.gtk_ico_image_load(gui.theme.tool_file_transfer, size)
            theme_tool_ublock = utils.gtk_ico_image_load(gui.theme.tool_ublock, size)
        else:
            theme_tool_font = gtk.STOCK_SELECT_FONT
            theme_tool_font_color = gtk.STOCK_SELECT_COLOR
            theme_tool_emotes = utils.gtk_ico_image_load(gui.theme.emote_to_path(':D', True), size)
            theme_tool_nudge = utils.gtk_ico_image_load(gui.theme.emote_to_path(':S', True), size)
            theme_tool_invite = gtk.STOCK_ADD
            theme_tool_clean = gtk.STOCK_CLEAR
            theme_tool_file_transfer = gtk.STOCK_GO_UP
            theme_tool_ublock = gtk.STOCK_STOP

        theme_tool_call = utils.gtk_ico_image_load(gui.theme.call, size)
        theme_tool_video = utils.gtk_ico_image_load(gui.theme.video, size)
        theme_tool_av = utils.gtk_ico_image_load(gui.theme.av, size)

        self.font = gtk.ToolButton(theme_tool_font)
        self.font.set_label(_('Select font'))
        self.font.set_tooltip_text(_('Select font')) 
        self.font.connect('clicked',
            lambda *args: self.handler.on_font_selected())

        self.color = gtk.ToolButton(theme_tool_font_color)
        self.color.set_label(_('Select font color'))
        self.color.set_tooltip_text(_('Select font color')) 
        self.color.connect('clicked',
            lambda *args: self.handler.on_color_selected())

        self.emotes = gtk.ToolButton(theme_tool_emotes)
        self.emotes.set_label(_('Send an emoticon'))
        self.emotes.set_tooltip_text(_('Send an emoticon')) 
        self.emotes.connect('clicked',
            lambda *args: self.handler.on_emotes_selected())

        self.nudge = gtk.ToolButton(theme_tool_nudge)
        self.nudge.set_label(_('Request attention'))
        self.nudge.set_tooltip_text(_('Request attention')) 
        self.nudge.connect('clicked',
            lambda *args: self.handler.on_notify_attention_selected())

        self.invite = gtk.ToolButton(theme_tool_invite)
        self.invite.set_label(_('Invite a buddy'))
        self.invite.set_tooltip_text(_('Invite a buddy')) 
        self.invite.connect('clicked',
            lambda *args: self.handler.on_invite_selected())

        self.clean = gtk.ToolButton(theme_tool_clean)
        self.clean.set_label(_('Clean the conversation'))
        self.clean.set_tooltip_text(_('Clean the conversation')) 
        self.clean.connect('clicked',
            lambda *args: self.handler.on_clean_selected())

        self.invite_file_transfer = gtk.ToolButton(theme_tool_file_transfer)
        self.invite_file_transfer.set_label(_('Send a file'))
        self.invite_file_transfer.set_tooltip_text(_('Send a file')) 
        self.invite_file_transfer.connect('clicked',
            lambda *args: self.handler.on_invite_file_transfer_selected())

        self.ublock = gtk.ToolButton(theme_tool_ublock)
        self.ublock.set_label(_('Block/Unblock contact'))
        self.ublock.set_tooltip_text(_('Block/Unblock contact')) 
        self.ublock.connect('clicked',
            lambda *args: self.handler.on_ublock_selected())

        self.invite_video_call = gtk.ToolButton(theme_tool_video)
        self.invite_video_call.set_label(_('Video Call'))
        self.invite_video_call.set_tooltip_text(_('Video Call')) 
        self.invite_video_call.connect('clicked',
            lambda *args: self.handler.on_invite_video_call_selected())

        self.invite_audio_call = gtk.ToolButton(theme_tool_call)
        self.invite_audio_call.set_label(_('Voice Call'))
        self.invite_audio_call.set_tooltip_text(_('Voice Call')) 
        self.invite_audio_call.connect('clicked',
            lambda *args: self.handler.on_invite_voice_call_selected())

        self.invite_av_call = gtk.ToolButton(theme_tool_av)
        self.invite_av_call.set_label(_('Audio/Video Call'))
        self.invite_av_call.set_tooltip_text(_('Audio/Video Call')) 
        self.invite_av_call.connect('clicked',
            lambda *args: self.handler.on_invite_av_call_selected())

        self.add(self.font)
        self.add(self.color)
        self.add(gtk.SeparatorToolItem())

        self.add(self.emotes)
        self.add(self.nudge)
        self.add(gtk.SeparatorToolItem())

        self.add(self.invite)
        if self.handler.session_filetransfer_supported():
            self.add(self.invite_file_transfer)
        self.add(gtk.SeparatorToolItem())

        if self.handler.session_call_supported():
            self.add(self.invite_video_call)
            self.add(self.invite_audio_call)
            self.add(self.invite_av_call)
            self.add(gtk.SeparatorToolItem())

        self.add(self.clean)
        self.add(self.ublock)
        self.add(gtk.SeparatorToolItem())
    def draw(self):
        '''draw the toolbar'''
        toolbar_small = self.handler.session.config.get_or_set(
                                                'b_toolbar_small',
                                                False)

        if toolbar_small:
            size = gtk.ICON_SIZE_MENU
        else:
            size = gtk.ICON_SIZE_LARGE_TOOLBAR

        if check_gtk3():
            context = self.get_style_context()
            gtk.StyleContext.add_class (context, "inline-toolbar")

        self.settings = self.get_settings()
        self.settings.set_long_property('gtk-toolbar-icon-size', size,
                                        'ConversationToolbar.py:37')

        # check if we have theme-specific toolbar-icons

        image_theme = gui.theme.image_theme
        if image_theme.has_custom_toolbar_icons():
            theme_tool_font = utils.gtk_ico_image_load(image_theme.tool_font, size)
            theme_tool_font_color = utils.gtk_ico_image_load(image_theme.tool_font_color, size)
            theme_tool_emotes = utils.gtk_ico_image_load(image_theme.tool_emotes, size)
            theme_tool_nudge = utils.gtk_ico_image_load(image_theme.tool_nudge, size)
            theme_tool_invite = utils.gtk_ico_image_load(image_theme.tool_invite, size)
            theme_tool_clean = utils.gtk_ico_image_load(image_theme.tool_clean, size)
            theme_tool_file_transfer = utils.gtk_ico_image_load(image_theme.tool_file_transfer, size)
            self.theme_tool_block = utils.gtk_ico_image_load(image_theme.tool_block, size)
            self.theme_tool_unblock = utils.gtk_ico_image_load(image_theme.tool_unblock, size)
        else:
            theme_tool_font = gtk.STOCK_SELECT_FONT
            theme_tool_font_color = gtk.STOCK_SELECT_COLOR

            emote_theme = gui.theme.emote_theme

            theme_tool_emotes = utils.gtk_ico_image_load(emote_theme.emote_to_path(':D', True), size)
            theme_tool_nudge = utils.gtk_ico_image_load(emote_theme.emote_to_path(':S', True), size)
            theme_tool_invite = gtk.STOCK_ADD
            theme_tool_clean = gtk.STOCK_CLEAR
            theme_tool_file_transfer = gtk.STOCK_GO_UP
            self.theme_tool_block = gtk.STOCK_STOP
            self.theme_tool_unblock = gtk.STOCK_YES

        if self.session.config.b_avatar_on_left == self.session.config.b_show_info:
            theme_tool_toggle_avatar = gtk.STOCK_GO_BACK
        else:
            theme_tool_toggle_avatar = gtk.STOCK_GO_FORWARD

        theme_tool_call = utils.gtk_ico_image_load(image_theme.call, size)
        theme_tool_video = utils.gtk_ico_image_load(image_theme.video, size)
        theme_tool_av = utils.gtk_ico_image_load(image_theme.av, size)

        self.font = gtk.ToolButton(theme_tool_font)
        self.font.set_label(_('Select font'))
        self.font.set_tooltip_text(_('Select font'))
        self.font.connect('clicked',
            lambda *args: self.handler.on_font_selected())

        self.color = gtk.ToolButton(theme_tool_font_color)
        self.color.set_label(_('Select font color'))
        self.color.set_tooltip_text(_('Select font color'))
        self.color.connect('clicked',
            lambda *args: self.handler.on_color_selected())

        self.emotes = gtk.ToolButton()
        self.emotes.set_icon_widget(theme_tool_emotes)
        self.emotes.set_label(_('Send an emoticon'))
        self.emotes.set_tooltip_text(_('Send an emoticon'))
        self.emotes.connect('clicked',
            lambda *args: self.handler.on_emotes_selected())

        self.nudge = gtk.ToolButton()
        self.nudge.set_icon_widget(theme_tool_nudge)
        self.nudge.set_label(_('Request attention'))
        self.nudge.set_tooltip_text(_('Request attention'))
        self.nudge.connect('clicked',
            lambda *args: self.handler.on_notify_attention_selected())

        self.invite = gtk.ToolButton(theme_tool_invite)
        self.invite.set_label(_('Invite a buddy'))
        self.invite.set_tooltip_text(_('Invite a buddy'))
        self.invite.connect('clicked',
            lambda *args: self.handler.on_invite_selected())

        self.clean = gtk.ToolButton(theme_tool_clean)
        self.clean.set_label(_('Clean the conversation'))
        self.clean.set_tooltip_text(_('Clean the conversation'))
        self.clean.connect('clicked',
            lambda *args: self.handler.on_clean_selected())

        self.invite_file_transfer = gtk.ToolButton(theme_tool_file_transfer)
        self.invite_file_transfer.set_label(_('Send a file'))
        self.invite_file_transfer.set_tooltip_text(_('Send a file'))
        self.invite_file_transfer.connect('clicked',
            lambda *args: self.handler.on_invite_file_transfer_selected())

        self.ublock = gtk.ToolButton(self.theme_tool_block)
        self.ublock.set_label(_('Block/Unblock contact'))
        self.ublock.set_tooltip_text(_('Block/Unblock contact'))
        self.ublock.connect('clicked',
            lambda *args: self.handler.on_ublock_selected())

        self.toggle_avatar = gtk.ToolButton(theme_tool_toggle_avatar)
        self.toggle_avatar.set_label(_('Hide/Show avatar'))
        if self.handler.session.config.b_show_info:
            self.toggle_avatar.set_tooltip_text(_('Hide avatar'))
        else:
            self.toggle_avatar.set_tooltip_text(_('Show avatar'))
        self.toggle_avatar.connect('clicked',
            lambda *args: self.handler.on_toggle_avatar_selected())

        self.invite_video_call = gtk.ToolButton(theme_tool_video)
        self.invite_video_call.set_label(_('Video Call'))
        self.invite_video_call.set_tooltip_text(_('Video Call'))
        self.invite_video_call.connect('clicked',
            lambda *args: self.handler.on_invite_video_call_selected())

        self.invite_audio_call = gtk.ToolButton(theme_tool_call)
        self.invite_audio_call.set_label(_('Voice Call'))
        self.invite_audio_call.set_tooltip_text(_('Voice Call'))
        self.invite_audio_call.connect('clicked',
            lambda *args: self.handler.on_invite_voice_call_selected())

        self.invite_av_call = gtk.ToolButton(theme_tool_av)
        self.invite_av_call.set_label(_('Audio/Video Call'))
        self.invite_av_call.set_tooltip_text(_('Audio/Video Call'))
        self.invite_av_call.connect('clicked',
            lambda *args: self.handler.on_invite_av_call_selected())

        self.add(self.font)
        self.add(self.color)
        self.add(gtk.SeparatorToolItem())

        self.add(self.emotes)
        self.add(self.nudge)

        if self.handler.session_service_supported(e3.Session.SERVICE_CONTACT_INVITE):
            self.add(gtk.SeparatorToolItem())
            self.add(self.invite)
        if self.handler.session_service_supported(e3.Session.SERVICE_FILETRANSFER):
            self.add(self.invite_file_transfer)
        self.add(gtk.SeparatorToolItem())

        if self.handler.session_service_supported(e3.Session.SERVICE_CALLS):
            self.add(self.invite_video_call)
            self.add(self.invite_audio_call)
            self.add(self.invite_av_call)
            self.add(gtk.SeparatorToolItem())

        self.add(self.clean)
        if self.handler.session_service_supported(e3.Session.SERVICE_CONTACT_BLOCK):
            self.add(self.ublock)
        self.add(gtk.SeparatorToolItem())
        self.add(self.toggle_avatar)
    def draw(self):
        """draw the toolbar"""
        toolbar_small = self.handler.session.config.get_or_set("b_toolbar_small", False)

        if toolbar_small:
            size = gtk.ICON_SIZE_MENU
        else:
            size = gtk.ICON_SIZE_LARGE_TOOLBAR

        whsize = gtk.icon_size_lookup(size)

        self.settings = self.get_settings()
        self.settings.set_long_property("gtk-toolbar-icon-size", size, "ConversationToolbar.py:37")

        # check if we have theme-specific toolbar-icons

        if gui.theme.toolbar_path:
            theme_tool_font = utils.gtk_ico_image_load(gui.theme.tool_font, size)
            theme_tool_font_color = utils.gtk_ico_image_load(gui.theme.tool_font_color, size)
            theme_tool_emotes = utils.gtk_ico_image_load(gui.theme.tool_emotes, size)
            theme_tool_nudge = utils.gtk_ico_image_load(gui.theme.tool_nudge, size)
            theme_tool_invite = utils.gtk_ico_image_load(gui.theme.tool_invite, size)
            theme_tool_clean = utils.gtk_ico_image_load(gui.theme.tool_clean, size)
            theme_tool_file_transfer = utils.gtk_ico_image_load(gui.theme.tool_file_transfer, size)
            theme_tool_ublock = utils.gtk_ico_image_load(gui.theme.tool_ublock, size)
        else:
            theme_tool_font = gtk.STOCK_SELECT_FONT
            theme_tool_font_color = gtk.STOCK_SELECT_COLOR
            theme_tool_emotes = utils.gtk_ico_image_load(gui.theme.emote_to_path(":D", True), size)
            theme_tool_nudge = utils.gtk_ico_image_load(gui.theme.emote_to_path(":S", True), size)
            theme_tool_invite = gtk.STOCK_ADD
            theme_tool_clean = gtk.STOCK_CLEAR
            theme_tool_file_transfer = gtk.STOCK_GO_UP
            theme_tool_ublock = gtk.STOCK_STOP

        theme_tool_call = utils.gtk_ico_image_load(gui.theme.call, size)
        theme_tool_video = utils.gtk_ico_image_load(gui.theme.video, size)
        theme_tool_av = utils.gtk_ico_image_load(gui.theme.av, size)

        self.font = gtk.ToolButton(theme_tool_font)
        self.font.set_label(_("Select font"))
        self.font.set_tooltip_text(_("Select font"))
        self.font.connect("clicked", lambda *args: self.handler.on_font_selected())

        self.color = gtk.ToolButton(theme_tool_font_color)
        self.color.set_label(_("Select font color"))
        self.color.set_tooltip_text(_("Select font color"))
        self.color.connect("clicked", lambda *args: self.handler.on_color_selected())

        self.emotes = gtk.ToolButton(theme_tool_emotes)
        self.emotes.set_label(_("Send an emoticon"))
        self.emotes.set_tooltip_text(_("Send an emoticon"))
        self.emotes.connect("clicked", lambda *args: self.handler.on_emotes_selected())

        self.nudge = gtk.ToolButton(theme_tool_nudge)
        self.nudge.set_label(_("Request attention"))
        self.nudge.set_tooltip_text(_("Request attention"))
        self.nudge.connect("clicked", lambda *args: self.handler.on_notify_attention_selected())

        self.invite = gtk.ToolButton(theme_tool_invite)
        self.invite.set_label(_("Invite a buddy"))
        self.invite.set_tooltip_text(_("Invite a buddy"))
        self.invite.connect("clicked", lambda *args: self.handler.on_invite_selected())

        self.clean = gtk.ToolButton(theme_tool_clean)
        self.clean.set_label(_("Clean the conversation"))
        self.clean.set_tooltip_text(_("Clean the conversation"))
        self.clean.connect("clicked", lambda *args: self.handler.on_clean_selected())

        self.invite_file_transfer = gtk.ToolButton(theme_tool_file_transfer)
        self.invite_file_transfer.set_label(_("Send a file"))
        self.invite_file_transfer.set_tooltip_text(_("Send a file"))
        self.invite_file_transfer.connect("clicked", lambda *args: self.handler.on_invite_file_transfer_selected())

        self.ublock = gtk.ToolButton(theme_tool_ublock)
        self.ublock.set_label(_("Block/Unblock contact"))
        self.ublock.set_tooltip_text(_("Block/Unblock contact"))
        self.ublock.connect("clicked", lambda *args: self.handler.on_ublock_selected())

        self.invite_video_call = gtk.ToolButton(theme_tool_video)
        self.invite_video_call.set_label(_("Video Call"))
        self.invite_video_call.set_tooltip_text(_("Video Call"))
        self.invite_video_call.connect("clicked", lambda *args: self.handler.on_invite_video_call_selected())

        self.invite_audio_call = gtk.ToolButton(theme_tool_call)
        self.invite_audio_call.set_label(_("Voice Call"))
        self.invite_audio_call.set_tooltip_text(_("Voice Call"))
        self.invite_audio_call.connect("clicked", lambda *args: self.handler.on_invite_voice_call_selected())

        self.invite_av_call = gtk.ToolButton(theme_tool_av)
        self.invite_av_call.set_label(_("Audio/Video Call"))
        self.invite_av_call.set_tooltip_text(_("Audio/Video Call"))
        self.invite_av_call.connect("clicked", lambda *args: self.handler.on_invite_av_call_selected())

        self.add(self.font)
        self.add(self.color)
        self.add(gtk.SeparatorToolItem())

        self.add(self.emotes)
        self.add(self.nudge)
        self.add(gtk.SeparatorToolItem())

        self.add(self.invite)
        self.add(self.invite_file_transfer)
        self.add(gtk.SeparatorToolItem())

        # self.add(self.invite_video_call)
        # self.add(self.invite_audio_call)
        # self.add(self.invite_av_call)
        # self.add(gtk.SeparatorToolItem())

        self.add(self.clean)
        self.add(self.ublock)
        self.add(gtk.SeparatorToolItem())