← Back to team overview

unity-design team mailing list archive

Thoughts on notify-osd API

 

Hi,

I have been going through notify-osd code lately and discussed it with
Mirco a bit. It seems we can provide a Qt implementation for notify-osd
while trying to keep as much code in common as possible. To do so we
need to split notify-osd in two layers: Core and UI. The actual
implementation of the Bubble class would be the GTK+ UI layer, while we
would then write a Qt implementation of this UI layer.

To get things started I decided to review the existing Bubble API and
see how we can formalize it in an interface which would be implemented
by the UI layer. Here it is:

-------------------------
# Enums
enum Urgency {
    LOW,
    NORMAL,
    CRITICAL
}

# Properties
## Public
id: int
title: utf8
message_body: utf8
icon_only: bool

# RFC: We can't use GdkPixbuf here as this would link with GTK+. It
# will be up to the ui layer to interpret the icon. This means we have
# to pass the ui layer both icon_name and icon_data and can't
# factorize the distinction.
icon_name: utf8
icon_data: binary

# RFC: was urgent, which sounds more like a bool.
urgency: Urgency

# RFC: synchronous was a string and used as a title for atk. I think
# this should be splitted.
synchronous: bool
a11y_title: utf8

# RFC: Was value, which is probably too common.
a11y_value: int
timeout: msecs
sender: utf8
append_allowed: bool
visible: bool (ro)
position: x,y (ro)
height: int (ro)
future_height: int (ro)

## Private
size: x,y
timer_id: int
mouse_over: bool
layout: BubbleLayout
enum BubbleLayout {
    LAYOUT_NONE = 0,
    LAYOUT_ICON_ONLY,
    LAYOUT_ICON_INDICATOR,
    LAYOUT_ICON_TITLE,
    LAYOUT_ICON_TITLE_BODY,
    LAYOUT_TITLE_BODY,
    LAYOUT_TITLE_ONLY
}

# Methods

## Public
move(x, y)
hide()
start_timer()
fade_in(msecs)
append_message_body(utf8)
sync_with(Bubble)

# RFC: Can't we keep those private? IMO it's up to the ui layer to
# know whether it needs to refresh its display or update its size.
refresh()
recalc_size()

# RFC: This one should not be in Bubble: it only uses Bubble as an
# information container
show_dialog(appname, utf8 actions[])

## Private
# RFC: hide is public, so maybe this should be public as well, for
# consistency
show()

# RFC: fade_in is public, so maybe this should be public as well, for
# consistency
fade_out(msecs)

# RFC: Is only called by recalc_size() and stack_notify_handler(), but
# stack_notify_handler() calls recalc_size() just after, so it can be
# made private (even more if recalc_size() is made private as well)
determine_layout()
-------------------------

Note that there is a few RFC in this for you to comment. What do you
think about this? does it sound reasonable?

Aurélien



Follow ups