Example #1
0
    def show_title(self, urgent=True):
        """redraw the window's title"""
        unread = 0
        for jid in self.nb_unread:
            unread += self.nb_unread[jid]
        start = ""
        if unread > 1:
            start = "[" + unicode(unread) + "] "
        elif unread == 1:
            start = "* "
        if len(self.xmls) > 1:  # if more than one tab in the same window
            if self.widget_name == "tabbed_chat_window":
                add = _("Chat")
            elif self.widget_name == "groupchat_window":
                add = _("Group Chat")
        elif len(self.xmls) == 1:  # just one tab
            if self.widget_name == "tabbed_chat_window":
                c = gajim.get_first_contact_instance_from_jid(self.account, jid)
                if c is None:
                    add = ""
                else:
                    add = c.name
            elif self.widget_name == "groupchat_window":
                name = gajim.get_nick_from_jid(jid)
                add = name

        title = start + add
        if len(gajim.connections) >= 2:  # if we have 2 or more accounts
            title += " (" + _("account: ") + self.account + ")"

        self.window.set_title(title)
        if urgent:
            gtkgui_helpers.set_unset_urgency_hint(self.window, unread)
Example #2
0
	def _on_window_focus(self, widget, event):
		# window received focus, so if we had urgency REMOVE IT
		# NOTE: we do not have to read the message (it maybe in a bg tab)
		# to remove urgency hint so this functions does that
		gtkgui_helpers.set_unset_urgency_hint(self.window, False)

		ctrl = self.get_active_control()
		if ctrl:
			ctrl.set_control_active(True)
			# Undo "unread" state display, etc.
			if ctrl.type_id == message_control.TYPE_GC:
				self.redraw_tab(ctrl, 'active')
			else:
				# NOTE: we do not send any chatstate to preserve
				# inactive, gone, etc.
				self.redraw_tab(ctrl)
Example #3
0
    def _on_window_focus(self, widget, event):
        # window received focus, so if we had urgency REMOVE IT
        # NOTE: we do not have to read the message (it maybe in a bg tab)
        # to remove urgency hint so this functions does that
        gtkgui_helpers.set_unset_urgency_hint(self.window, False)

        ctrl = self.get_active_control()
        if ctrl:
            ctrl.set_control_active(True)
            # Undo "unread" state display, etc.
            if ctrl.type_id == message_control.TYPE_GC:
                self.redraw_tab(ctrl, 'active')
            else:
                # NOTE: we do not send any chatstate to preserve
                # inactive, gone, etc.
                self.redraw_tab(ctrl)
Example #4
0
	def show_title(self, urgent=True, control=None):
		'''redraw the window's title'''
		if not control:
			control = self.get_active_control()
		if not control:
			# No more control in this window
			return
		unread = 0
		for ctrl in self.controls():
			if ctrl.type_id == message_control.TYPE_GC and not \
			gajim.config.get('notify_on_all_muc_messages') and not \
			ctrl.attention_flag:
				# count only pm messages
				unread += ctrl.get_nb_unread_pm()
				continue
			unread += ctrl.get_nb_unread()

		unread_str = ''
		if unread > 1:
			unread_str = '[' + unicode(unread) + '] '
		elif unread == 1:
			unread_str = '* '
		else:
			urgent = False

		if control.type_id == message_control.TYPE_GC:
			name = control.room_jid.split('@')[0]
			urgent = control.attention_flag
		else:
			name = control.contact.get_shown_name()
			if control.resource:
				name += '/' + control.resource

		window_mode = gajim.interface.msg_win_mgr.mode
		if window_mode == MessageWindowMgr.ONE_MSG_WINDOW_PERTYPE:
			# Show the plural form since number of tabs > 1
			if self.type == 'chat':
				label = _('Chats')
			elif self.type == 'gc':
				label = _('Group Chats')
			else:
				label = _('Private Chats')
		elif window_mode == MessageWindowMgr.ONE_MSG_WINDOW_ALWAYS_WITH_ROSTER:
			label = None
		elif self.get_num_controls() == 1:
			label = name
		else:
			label = _('Messages')

		title = 'Gajim'
		if label:
			title = '%s - %s' % (label, title)

		if window_mode == MessageWindowMgr.ONE_MSG_WINDOW_PERACCT:
			title = title + ": " + control.account

		self.window.set_title(unread_str + title)

		if urgent:
			gtkgui_helpers.set_unset_urgency_hint(self.window, unread)
		else:
			gtkgui_helpers.set_unset_urgency_hint(self.window, False)
Example #5
0
    def show_title(self, urgent=True, control=None):
        '''redraw the window's title'''
        if not control:
            control = self.get_active_control()
        if not control:
            # No more control in this window
            return
        unread = 0
        for ctrl in self.controls():
            if ctrl.type_id == message_control.TYPE_GC and not \
            gajim.config.get('notify_on_all_muc_messages') and not \
            ctrl.attention_flag:
                # count only pm messages
                unread += ctrl.get_nb_unread_pm()
                continue
            unread += ctrl.get_nb_unread()

        unread_str = ''
        if unread > 1:
            unread_str = '[' + unicode(unread) + '] '
        elif unread == 1:
            unread_str = '* '
        else:
            urgent = False

        if control.type_id == message_control.TYPE_GC:
            name = control.room_jid.split('@')[0]
            urgent = control.attention_flag
        else:
            name = control.contact.get_shown_name()
            if control.resource:
                name += '/' + control.resource

        window_mode = gajim.interface.msg_win_mgr.mode
        if window_mode == MessageWindowMgr.ONE_MSG_WINDOW_PERTYPE:
            # Show the plural form since number of tabs > 1
            if self.type == 'chat':
                label = _('Chats')
            elif self.type == 'gc':
                label = _('Group Chats')
            else:
                label = _('Private Chats')
        elif window_mode == MessageWindowMgr.ONE_MSG_WINDOW_ALWAYS_WITH_ROSTER:
            label = None
        elif self.get_num_controls() == 1:
            label = name
        else:
            label = _('Messages')

        title = 'Gajim'
        if label:
            title = '%s - %s' % (label, title)

        if window_mode == MessageWindowMgr.ONE_MSG_WINDOW_PERACCT:
            title = title + ": " + control.account

        self.window.set_title(unread_str + title)

        if urgent:
            gtkgui_helpers.set_unset_urgency_hint(self.window, unread)
        else:
            gtkgui_helpers.set_unset_urgency_hint(self.window, False)