[knuckles] event images in old style notifications; /me did some rearranging in glade so they look better

This commit is contained in:
Nikos Kouremenos 2006-01-18 20:30:24 +00:00
parent 8c33fab699
commit 5367d4a4fb
2 changed files with 129 additions and 60 deletions

View File

@ -872,6 +872,7 @@ class PopupNotificationWindow:
event_type_label = xml.get_widget('event_type_label')
event_description_label = xml.get_widget('event_description_label')
eventbox = xml.get_widget('eventbox')
image = xml.get_widget('notification_image')
event_type_label.set_markup(
'<span foreground="black" weight="bold">%s</span>' % event_type)
@ -885,18 +886,37 @@ class PopupNotificationWindow:
# set colors [ http://www.pitt.edu/~nisg/cis/web/cgi/rgb.html ]
self.window.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('black'))
# prefix for images
transport_name = gajim.get_transport_name_from_jid(jid)
if transport_name in ('aim', 'icq', 'msn', 'yahoo'):
prefix = transport_name
else:
prefix = 'jabber'
# default image
img = 'chat_msg_recv.png'
if event_type == _('Contact Signed In'):
limegreen = gtk.gdk.color_parse('limegreen')
close_button.modify_bg(gtk.STATE_NORMAL, limegreen)
eventbox.modify_bg(gtk.STATE_NORMAL, limegreen)
event_description_label.set_markup(
'<span foreground="black">%s</span>' % txt)
path_to_file = os.path.join(gajim.AVATAR_PATH, jid) + '_notif_size_colored.png'
if not os.path.exists(path_to_file):
img = prefix + '_online.png'
else:
img = path_to_file
elif event_type == _('Contact Signed Out'):
red = gtk.gdk.color_parse('red')
close_button.modify_bg(gtk.STATE_NORMAL, red)
eventbox.modify_bg(gtk.STATE_NORMAL, red)
event_description_label.set_markup(
'<span foreground="black">%s</span>' % txt)
path_to_file = os.path.join(gajim.AVATAR_PATH, jid) + '_notif_size_bw.png'
if not os.path.exists(path_to_file):
img = prefix + '_offline.png'
else:
img = path_to_file
elif event_type in (_('New Message'), _('New Single Message'),
_('New Private Message')):
dodgerblue = gtk.gdk.color_parse('dodgerblue')
@ -906,8 +926,13 @@ class PopupNotificationWindow:
room_jid, nick = gajim.get_room_and_nick_from_fjid(jid)
room_name,t = gajim.get_room_name_and_server_from_room_jid(room_jid)
txt = _('From %s in room %s') % (nick, room_name)
img = 'priv_msg_recv.png'
else:
txt = _('From %s') % txt
if event_type == _('New Message'):
img = 'chat_msg_recv.png'
else: # New Single Message
img = 'single_msg_recv.png'
event_description_label.set_markup('<span foreground="black">%s</span>' % txt)
elif event_type == _('File Transfer Request'):
bg_color = gtk.gdk.color_parse('khaki')
@ -915,11 +940,13 @@ class PopupNotificationWindow:
eventbox.modify_bg(gtk.STATE_NORMAL, bg_color)
txt = _('From %s') % txt
event_description_label.set_markup('<span foreground="black">%s</span>' % txt)
img = 'ft_request.png'
elif event_type == _('File Transfer Error'):
bg_color = gtk.gdk.color_parse('firebrick')
close_button.modify_bg(gtk.STATE_NORMAL, bg_color)
eventbox.modify_bg(gtk.STATE_NORMAL, bg_color)
event_description_label.set_markup('<span foreground="black">%s</span>' % txt)
img = 'ft_stopped.png'
elif event_type in (_('File Transfer Completed'),
_('File Transfer Stopped')):
bg_color = gtk.gdk.color_parse('yellowgreen')
@ -932,6 +959,10 @@ class PopupNotificationWindow:
name = gajim.contacts.get_first_contact_from_jid(account,
sender).get_shown_name()
txt = _('From %s') % name
if event_type == _('File Transfer Completed'):
img = 'ft_done.png'
else: # ft stopped
img = 'ft_stopped.png'
else:
receiver = file_props['receiver']
if hasattr(receiver, 'jid'):
@ -941,6 +972,10 @@ class PopupNotificationWindow:
name = gajim.contacts.get_first_contact_from_jid(account,
receiver).get_shown_name()
txt = _('To %s') % name
if event_type == _('File Transfer Completed'):
img = 'ft_done.png'
else: # ft stopped
img = 'ft_stopped.png'
else:
txt = ''
event_description_label.set_markup('<span foreground="black">%s</span>' % txt)
@ -951,6 +986,13 @@ class PopupNotificationWindow:
text = i18n.ngettext('You have %d new E-mail message', 'You have %d new E-mail messages', gmail_new_messages, gmail_new_messages, gmail_new_messages)
txt = _('%(new_mail_gajim_ui_msg)s on %(gmail_mail_address)s') % {'new_mail_gajim_ui_msg': text, 'gmail_mail_address': jid}
event_description_label.set_markup('<span foreground="black">%s</span>' % txt)
img = 'single_msg_recv.png' #FIXME: find a better image
# set the image
path = os.path.join(gajim.DATA_DIR, 'pixmaps', 'events', img)
path = os.path.abspath(path)
image.set_from_file(path)
# position the window to bottom-right of screen
window_width, self.window_height = self.window.get_size()
gajim.interface.roster.popups_notification_height += self.window_height

View File

@ -2343,13 +2343,12 @@
<child>
<widget class="GtkLabel" id="from_label">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">True</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
@ -10776,17 +10775,38 @@ Custom</property>
<property name="above_child">False</property>
<child>
<widget class="GtkVBox" id="vbox63">
<property name="border_width">2</property>
<widget class="GtkHBox" id="hbox3019">
<property name="border_width">4</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">6</property>
<child>
<widget class="GtkHBox" id="hbox2945">
<widget class="GtkImage" id="notification_image">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="vbox111">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">5</property>
<property name="spacing">0</property>
<child>
<widget class="GtkHBox" id="hbox3020">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkLabel" id="event_type_label">
@ -10808,8 +10828,8 @@ Custom</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
@ -10841,8 +10861,8 @@ Custom</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
@ -10864,6 +10884,13 @@ Custom</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>