if we have pygtk28/gtk28 we now set UrgencyHint instead of just *. I LOVE 2.8 [see inside for new way via .props] CONGRAAAAAATS to jdahlin, gjc and rest of gang :)

This commit is contained in:
Nikos Kouremenos 2005-09-04 16:57:09 +00:00
parent 12d91afaf2
commit 74ceb1f9f8
5 changed files with 32 additions and 4 deletions

View File

@ -24,6 +24,7 @@ import gobject
import time
import dialogs
import history_window
import gtkgui_helpers
try:
import gtkspell
@ -157,6 +158,7 @@ class Chat:
title += ' (' + _('account: ') + self.account + ')'
self.window.set_title(title)
gtkgui_helpers.set_unset_urgency_hint(self.window, unread)
def redraw_tab(self, jid):
"""redraw the label of the tab"""
@ -241,6 +243,13 @@ class Chat:
self.show_title()
if self.plugin.systray_enabled:
self.plugin.systray.remove_jid(jid, self.account)
'''TC/GC 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'''
if gtk.gtk_version >= (2, 8, 0) and gtk.pygtk_version >= (2, 8, 0):
if widget.props.urgency_hint:
widget.props.urgency_hint = False
def on_compact_view_menuitem_activate(self, widget):
isactive = widget.get_active()

View File

@ -21,6 +21,7 @@
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<signal name="delete_event" handler="on_roster_window_delete_event" last_modification_time="Mon, 21 Mar 2005 12:34:59 GMT"/>
<signal name="focus_in_event" handler="on_roster_window_focus_in_event" last_modification_time="Sun, 04 Sep 2005 16:33:35 GMT"/>
<child>
<widget class="GtkVBox" id="roster_vbox">

View File

@ -167,7 +167,7 @@ def autodetect_browser_mailer():
gajim.config.set('openwith', 'custom')
def move_window(window, x, y):
''' moves the window but also checks if out of screen '''
'''moves the window but also checks if out of screen'''
if x < 0:
x = 0
if y < 0:
@ -175,10 +175,18 @@ def move_window(window, x, y):
window.move(x, y)
def resize_window(window, w, h):
''' resizes window but also checks if huge window or negative values '''
'''resizes window but also checks if huge window or negative values'''
if w > screen_w:
w = screen_w
if h > screen_h:
h = screen_h
window.resize(abs(w), abs(h))
def set_unset_urgency_hint(window, unread_messages_no):
'''sets/unsets urgency hint in window argument
depending if we have unread messages or not'''
if gtk.gtk_version >= (2, 8, 0) and gtk.pygtk_version >= (2, 8, 0):
if unread_messages_no > 0:
window.props.urgency_hint = True
else:
window.props.urgency_hint = False

View File

@ -1525,6 +1525,14 @@ _('If "%s" accepts this request you will know his status.') %jid)
self.quit_gtkgui_plugin()
return True # do NOT destory the window
def on_roster_window_focus_in_event(self, widget, event):
'''roster received focus, so if we had urgency REMOVE IT
NOTE: we do not have to read the message to remove urgency
so this functions does that'''
if gtk.gtk_version >= (2, 8, 0) and gtk.pygtk_version >= (2, 8, 0):
if widget.props.urgency_hint:
widget.props.urgency_hint = False
def quit_gtkgui_plugin(self):
'''When we quit the gtk plugin :
tell that to the core and exit gtk'''
@ -2028,10 +2036,12 @@ _('If "%s" accepts this request you will know his status.') %jid)
if change_title_allowed:
start = ''
if self.nb_unread > 1:
start = '[' + unicode(self.nb_unread) + '] '
start = '[' + str(self.nb_unread) + '] '
elif self.nb_unread == 1:
start = '* '
self.window.set_title(start + 'Gajim')
gtkgui_helpers.set_unset_urgency_hint(self.window, self.nb_unread)
def __init__(self, plugin):
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'roster_window', APP)

View File

@ -55,7 +55,7 @@ class TabbedChatWindow(chat.Chat):
self.dnd_list = [ ( 'text/uri-list', 0, self.TARGET_TYPE_URI_LIST ) ]
self.new_tab(user)
self.show_title()
# NOTE: if it not a window event, connect in new_tab function
signal_dict = {
'on_tabbed_chat_window_destroy': self.on_tabbed_chat_window_destroy,