default status msg remove bold add border to make it HIG

This commit is contained in:
Nikos Kouremenos 2006-08-27 15:39:11 +00:00
parent a5efb8b02b
commit 89edefc053
5 changed files with 117 additions and 21 deletions

View File

@ -2547,6 +2547,7 @@ Disabled</property>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow24">
<property name="border_width">6</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
@ -2573,9 +2574,9 @@ Disabled</property>
<child>
<widget class="GtkLabel" id="label384">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Default Status Messages&lt;/b&gt;</property>
<property name="label" translatable="yes">Default Status Messages</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>

View File

@ -1884,6 +1884,11 @@ class Interface:
self.systray_enabled = False
self.systray_capabilities = False
if gtk.pygtk_version >= (2, 10, 0) and gtk.gtk_version >= (2, 10, 0):
import statusicon
self.systray = statusicon.StatusIcon()
self.systray_capabilities = True
else: #FIXME: remove the following (and the files) when we migrate to 2.10
if os.name == 'nt':
try:
import systraywin32

View File

@ -655,14 +655,11 @@ class RosterWindow:
def on_history_manager_menuitem_activate(self, widget):
if os.name == 'nt':
if os.path.exists('history_manager.exe'): # user is running stable
os.startfile('history_manager.exe')
helpers.exec_command('history_manager.exe')
else: # user is running svn
try:
os.startfile('history_manager.py')
except: # user doesn't have pywin32, too bad for him
pass
helpers.exec_command('history_manager.py')
else: # Unix user
os.system('python history_manager.py &')
helpers.exec_command('python history_manager.py &')
def get_and_connect_advanced_menuitem_menu(self, account):
'''adds FOR ACCOUNT options'''

93
src/statusicon.py Normal file
View File

@ -0,0 +1,93 @@
## statusicon.py
##
## Copyright (C) 2006 Nikos Kouremenos <kourem@gmail.com>
##
## This program is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License
## as published by the Free Software Foundation; either version 2
## of the License, or (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
import gtk
import systray
class StatusIcon(systray.Systray):
'''Class for the notification area icon'''
#FIXME: when we migrate to GTK 2.10 stick only to this class
# (remove systraywin32.py and systray.py)
def __init__(self):
self.status_icon = gtk.StatusIcon()
def show_icon(self):
self.status_icon.props.visible = True
def hide_icon(self):
self.status_icon.props.visible = False
def on_clicked(self, widget, event):
self.on_tray_leave_notify_event(widget, None)
if event.button == 1: # Left click
self.on_left_click()
elif event.button == 2: # middle click
self.on_middle_click()
elif event.button == 3: # right click
self.make_menu(event)
def add_jid(self, jid, account, typ):
systray.Systray.add_jid(self, jid, account, typ)
unread_messages = gajim.interface.roster.nb_unread
for acct in gajim.connections:
# in chat / groupchat windows
for kind in ('chats', 'gc'):
jids = gajim.interface.instances[acct][kind]
for jid in jids:
if jid != 'tabbed':
unread_messages += jids[jid].nb_unread[jid]
text = i18n.ngettext(
'Gajim - %d unread message',
'Gajim - %d unread messages',
unread_messages, unread_messages, unread_messages)
self.status_icon.set_tooltip(text)
def remove_jid(self, jid, account, typ):
systray.Systray.remove_jid(self, jid, account, typ)
unread_messages = gajim.interface.roster.nb_unread
for acct in gajim.connections:
# in chat / groupchat windows
for kind in ('chats', 'gc'):
for jid in gajim.interface.instances[acct][kind]:
if jid != 'tabbed':
unread_messages += gajim.interface.instances[acct][kind][jid].nb_unread[jid]
if unread_messages > 0:
text = i18n.ngettext(
'Gajim - %d unread message',
'Gajim - %d unread messages',
unread_messages, unread_messages, unread_messages)
else:
text = 'Gajim'
self.status_icon.set_tooltip(text)
def set_img(self):
if not gajim.interface.systray_enabled:
return
if len(self.jids) > 0:
state = 'message'
else:
state = self.status
image = gajim.interface.roster.jabber_state_images['16'][state]
if image.get_storage_type() == gtk.IMAGE_PIXBUF:
self.status_icon.props.pixbuf = image.get_pixbuf()
#FIXME: oops they forgot to support GIF animation?
#or they were lazy to get it to work under Windows! WTF!
#elif image.get_storage_type() == gtk.IMAGE_ANIMATION:
# self.img_tray.set_from_animation(image.get_animation())

View File

@ -2,7 +2,7 @@
##
## Copyright (C) 2003-2006 Yann Le Boulanger <asterix@lagaule.org>
## Copyright (C) 2003-2004 Vincent Hanquez <tab@snarc.org>
## Copyright (C) 2005-2006 Nikos Kouremenos <nkour@jabber.org>
## Copyright (C) 2005-2006 Nikos Kouremenos <kourem@gmail.com>
## Copyright (C) 2005 Dimitur Kirov <dkirov@gmail.com>
## Copyright (C) 2005-2006 Travis Shirk <travis@pobox.com>
## Copyright (C) 2005 Norman Rasmussen <norman@rasmussen.co.za>
@ -77,7 +77,7 @@ class Systray:
def add_jid(self, jid, account, typ, advanced_notif_num = None):
l = [account, jid, typ]
# We can keep several single message 'cause we open them one by one
# We can keep several single message because we open them one by one
if not l in self.jids or typ == 'normal':
self.jids.append(l)
self.set_img(advanced_notif_num)