Commit Graph

107 Commits

Author SHA1 Message Date
Sardem FF7
8f3376ce62 Add "precision" to boxpointer alignment
Allows the boxpointer arrow to be at a fixed percentage of the bubble

https://bugzilla.gnome.org/show_bug.cgi?id=642031
2011-02-16 10:19:39 -05:00
Marina Zhurakhinskaya
1aba99336a MessageTray: fix showing and hiding summary notifications when summary items are clicked
This patch fixes the summary notification reappearing if you click on the
summary item to hide it and hover away. It also ensures that when you click
on any summary item which doesn't correspond to the summary notification
being shown, a new summary notification will replace it right away.

What used to happen is that we'd unset the clicked item in _unlock() that
was called when the focus was ungrabbed because the user clicked outside
of the summary notification, but then would have this._clickedSummaryItem
be null in _onSummaryItemClicked() , and set it to the clicked item all
over again. This patch ensures that we unset the clicked item only when
it is necessary.

We also needed to add the code to call _updateState() again to show a new
summary notification when a previous one was hidden, but
this._clickedSummaryItem was set.

https://bugzilla.gnome.org/show_bug.cgi?id=642005
2011-02-15 18:37:33 -05:00
Dan Winship
1224e959b6 StThemeNode: use (out caller-allocates) on ClutterColor-returning methods
Properly annotate the themenode methods that return ClutterColors, and
update their JS callers to take advantage of that.

https://bugzilla.gnome.org/show_bug.cgi?id=642295
2011-02-14 10:49:26 -05:00
Marina Zhurakhinskaya
de3ae87199 MessageTray: factor out focus grabbing from Notification into a separate class
That way it can be used when other components of the message tray need to
grab focus, such as the summary bubble with multiple notifications or the
summary item's right click menu.

https://bugzilla.gnome.org/show_bug.cgi?id=641810
2011-02-10 11:50:29 -05:00
Marina Zhurakhinskaya
9ec2d5d609 Add mouseButtonClicked argument to the callback for St.Button 'clicked' signal in Notification
St.Button 'clicked' signal now has two arguments, and because we are also
passing an action id as an argument to the _onActionInvoked() callback,
we need to have the number of the signal arguments reflected accurately in
the function arguments.

https://bugzilla.gnome.org/show_bug.cgi?id=641809
2011-02-08 11:22:51 -05:00
Marina Zhurakhinskaya
5437a3be4b Only animate the message tray items on a hover of a new item or when the tray is left
This makes the animation feel more stable and keeps the left-most item expanded
when you move the mouse to the left in the tray.

The following behavior details are implemented by this patch:
  - we wait to collapse an expanded item till after the tray is hidden if
    we are hiding the tray
  - we don't collapse an expanded item if the summary notification associated
    with it is being shown, unless a different summary item is hovered over
  - we don't consider the mouse hovering over a summary notification as
    hovering over the tray, which allows us to collapse an expanded summary
    item if it is not associated with the summary notification being shown

https://bugzilla.gnome.org/show_bug.cgi?id=636930
2011-02-07 13:17:34 -05:00
Hellyna Ng
6c55ca59b0 Group chat sources on the left in the message tray
This will make it easier for users to get back to their chats.

https://bugzilla.gnome.org/show_bug.cgi?id=617234
2011-02-01 15:29:14 -05:00
Hellyna Ng
0e4a47c0aa Enables navigation using arrow keys in notifications with buttons.
Users can now use the keyboard and mouse to navigate with buttons
interchangeably, instead of entirely using only mouse.

https://bugzilla.gnome.org/show_bug.cgi?id=630937
2011-02-01 15:12:00 -05:00
Marina Zhurakhinskaya
7369ea6125 Make sure we only emit 'destroy' for a notification once
There are multiple code passes that can result in Notification::destroy()
being called, such as a notification being closed by the application
when it exits and the associated source being removed at the same time.
However, we should only emit 'destroy' for the notification and
do the associated work once.
2011-01-30 18:53:19 -05:00
Marina Zhurakhinskaya
20b7d34577 Avoid passing 'source' as an argument to Notification::destroy()
Notification::destroy() now takes 'reason' as an optional argument.
Calling Notification::destroy() directly when connecting to 'destroy'
on Source, as we did before, was inadvertently passing 'source' as an
argument to the function.

https://bugzilla.gnome.org/show_bug.cgi?id=640976
2011-01-30 18:53:07 -05:00
Marina Zhurakhinskaya
5666fdefce Add a missing colon
Fixes a syntax error.
2011-01-28 13:31:16 -05:00
Marina Zhurakhinskaya
e9613b0340 Emit NotificationClosed for a notification iff we destroy it
This fixes emitting NotificationClosed for resident notifications
that are clicked, but are not actually destroyed.

This also ensures that we emit NotificationClosed in all cases when
a notification is destroyed, which can happen when:
- a non-resident notification is clicked
- an action is invoked on a non-resident notification
- an application the notification was associated with is focused
- a transient notification is done showing
- a notification was requested to be closed by the application
- a tray icon the notification was associated with is removed

https://bugzilla.gnome.org/show_bug.cgi?id=638071
2011-01-28 13:02:20 -05:00
Adel Gadllah
00ba937171 StScrollView: Implement real fade effect
Implement an edge fade effect (top/bottom) using a
ClutterOffscreenEffect subclass, replacing the former
shadow hack.

https://bugzilla.gnome.org/show_bug.cgi?id=639460
2011-01-20 20:53:20 +01:00
Marina Zhurakhinskaya
cb4c2ab824 Don't reset y position of expanded notifications when updating them
This fixes the problem of chat notifications collapsing and then expanding
again when receiving multiple messages in the expanded new notification.

https://bugzilla.gnome.org/show_bug.cgi?id=629557
2011-01-18 15:08:46 -05:00
Marina Zhurakhinskaya
a681a2ba02 Remove _onKeyPress() function in Notification
Its usage was removed in commit 4dd4c9f99f -
"Use more actor.grab_key_focus() and less stage.connect('key-press-event')".
2011-01-13 18:33:01 -05:00
Dan Winship
8bdfb8df68 util: add Util.spawn and friends
Add Util.spawn, Util.spawnCommandLine, and Util.spawnDesktop for
spawning a command/argv/.desktop file in the background, automatically
handling errors via MessageTray.SystemNotificationSource(), and
Util.trySpawn, Util.trySpawnCommandLine, and Utils.trySpawnDesktop
that don't do automatic error handling (but do at least clean up the
error message in the exception a bit).

Update various other bits of code around the shell to use the new
methods.

https://bugzilla.gnome.org/show_bug.cgi?id=635089
2011-01-13 12:14:40 -05:00
Dan Winship
a65a0f03d4 util: rename from utils, avoid RegExp literal
Rename imports.misc.utils to imports.misc.util for more consistency
(eg, with shell-util).

Also, use the string-based RegExp() constructor rather than a RegExp
literal, since the literal is extremely difficult to parse correctly,
and confuses emacs and probably other editors and thus messes up
autoindentation, etc.

https://bugzilla.gnome.org/show_bug.cgi?id=635089
2011-01-13 12:14:40 -05:00
Dan Winship
7322a4e4ef messageTray: add SystemNotificationSource, moved from overview.js
Move the overview's "System Information" source here, so it can be
used by non-overview code as well.

https://bugzilla.gnome.org/show_bug.cgi?id=635089
2011-01-13 12:14:40 -05:00
Hellyna Ng
81714ce1a3 Notifications with CRITICAL urgency are no longer timed out
Notifications with CRITICAL urgency should not pop down until the user interacts with them.

https://bugzilla.gnome.org/show_bug.cgi?id=630942
2011-01-11 16:38:46 -05:00
Dan Winship
4c4a703e63 messageTray: use alignment rather than gravity to position the summary
Actors in clutter are supposed to be re-allocated with
Clutter.AllocationFlags.ABSOLUTE_ORIGIN_CHANGED if they move relative
to the screen, even if they don't move relative to their parent.
Currently this does not work correctly for actors inside containers
with non-northwest gravity. This is probably a fixable bug, but
gravity has messed up other things in the past too, so let's just not
use it.

This change ensures that summary trayicons are re-allocated when the
summary animates, and is part of the fix for
https://bugzilla.gnome.org/show_bug.cgi?id=635695
2011-01-10 15:22:50 -05:00
Hellyna Ng
f60b995236 Chats should jump to the top of the notification queue.
This is to ensure users get notified as soon as chats are received.
Notifications with critical urgency still have the highest priority.

https://bugzilla.gnome.org/show_bug.cgi?id=630934
2011-01-05 17:23:01 -05:00
Dan Winship
1694148bdb popupMenu: don't animate menus when switching from one to another
Don't do the "slide" effect when moving from one menu to another; only
do it when opening the first menu, or closing a menu without opening
another one.

https://bugzilla.gnome.org/show_bug.cgi?id=634755
2010-12-21 17:11:38 -05:00
Dan Winship
4dd4c9f99f Use more actor.grab_key_focus() and less stage.connect('key-press-event')
Until recently, the clutter keyboard focus was almost always kept on
the stage, and bits of code that wanted to do stuff with the keyboard
would just watch for key-press-events on the stage. In several places,
the code wasn't even bothering to ensure that the focus was on the
stage, which caused problems with other actors that explicitly grabbed
focus.

A previous fix for this (f21403fd) was to always reset the focus to
the stage after calling pushModal(), but a better fix is to just
actually make use of the keyboard focus everywhere rather than having
everyone try to read events off the stage.

Now pushModal(actor) also does actor.grab_key_focus(), and various
bits of code have been changed to read key events off their own
toplevels rather than off the stage, meaning there's no chance of them
accidentally getting someone else's events.

https://bugzilla.gnome.org/show_bug.cgi?id=618885
2010-12-20 17:32:07 -05:00
Marina Zhurakhinskaya
22f4aabadf NotificationDaemon: add support for transient notifications
Transient notifications are removed after being shown. If the summary
is being shown while they appear, they are represented in it by a new
source icon.

We always create a new source for new transient notifications to
ensure that they don't replace the latest persistent notification
associated with the source. Because we generally don't want any
new or resident notifications to be replaced by others, associating
multiple notifications with a source is the next thing we will
implement.

https://bugzilla.gnome.org/show_bug.cgi?id=633412
2010-12-16 15:50:29 -05:00
Marina Zhurakhinskaya
2a19d5f143 NotificationDaemon: add support for resident notifications
Resident notifications don't get removed when they are clicked or
one of their actions is invoked, and are only removed when the app
that created them requests them to be removed or sends another
notification.

Remove the source when a notification associated with it is removed.
Except if the source is a tray icon.

Make sure that we pop down the tray when a notification is clicked
or one of the actions of a non-resident notification is selected.

Based on the initial patch by Jonathan Matthew.

https://bugzilla.gnome.org/show_bug.cgi?id=633412
2010-12-16 15:49:47 -05:00
Florian Müllner
7c980f42c9 message-tray: Fix typo
At one place, we set State.SHOWNING instead of State.SHOWING.

Thanks to Jasper St. Pierre for spotting this.
2010-11-30 17:56:59 +01:00
Giovanni Campagna
926ddc2bdf Show timestamp in expanded chat
When the last message is older than SCROLLBACK_IMMEDIATE_TIME (1
minutes), show a timestamp in the middle, indicating the time it
was sent.
Use the same style for presence changes, but show them on the left.

https://bugzilla.gnome.org/show_bug.cgi?id=617228
2010-11-25 15:31:46 +01:00
Dan Winship
d6f1c10b1b messageTray: fix handling of markup vs non-markup notifications
NotificationDaemon-based notifications have markup in the banner/body,
but Telepathy-based notifications don't. (Eg, an XMPP message
containing "<b>foo</b>" should show up angle brackets and all, not as
bold.) Fix MessageTray.Notification to allow explicitly specifying
where there should and shouldn't be markup, and use that
appropriately.

https://bugzilla.gnome.org/show_bug.cgi?id=610219
2010-11-24 02:38:17 +03:00
Maxim Ermilov
65f0b483f8 messageTray: make links in message banners clickable
https://bugzilla.gnome.org/show_bug.cgi?id=610219
2010-11-24 02:38:08 +03:00
Owen W. Taylor
0e3431ac47 Use St.Icon for named icons
Switch from St.TextureCache.load_named_icon() to using St.Icon for named
icons. Along with the advantage of getting colorization right for symbolic
icons, this allows moving some icon sizes into the CSS.

In the CSS, the system status icon size is changed to be 1em (=16px for the
default font size), at the request of the artists. See bug 613448.

https://bugzilla.gnome.org/show_bug.cgi?id=633865
2010-11-12 17:36:26 -05:00
Jonathan Matthew
9585c823d5 MessageTray: only create icon buttons if specifically requested
Action names sometimes unintentionally overlap with icon names, so
we should only create icon buttons if the message tray source requests
it.  For the notification daemon, this is done by setting the
'action-icons' hint on the notification.

The previous notification server capability used to advertise this
feature, "x-gnome-icon-buttons", has been removed in favour of the
new capability described in the notification spec, "action-icons".

https://bugzilla.gnome.org/show_bug.cgi?id=624584
2010-11-02 19:17:29 +10:00
Hellyna Ng
3640a4dd1e Increase the timeout for hiding the tray if the mouse didn't move far from it
We shouldn't hide the tray as quickly if the user might have left it
unintentionally, such as when moving the mouse over to a different tray item or
using the scroll bar in the chat notification.

https://bugzilla.gnome.org/show_bug.cgi?id=630767
2010-10-30 17:20:13 -04:00
Dan Winship
8886b7433c StThemeNode: simplify use of get_color/get_double/get_length
Although within St itself there are situations where the semantics of
these functions (return TRUE or FALSE and return the actual value in
an out parameter) is useful, it's mostly just annoying at the
application level, where you generally know that the CSS property is
going to specified, and there is no especially sane fallback if it's
not.

So rename the current methods to lookup_color, lookup_double, and
lookup_length, and add new get_color, get_double, and get_length
methods that don't take an "inherit" parameter, and return their
values directly. (Well, except for get_color, due to the lack of (out
caller-allocates) in gjs.)

And update the code to use either the old or new methods as appropriate.

https://bugzilla.gnome.org/show_bug.cgi?id=632590
2010-10-21 15:02:33 -04:00
Maxim Ermilov
13229a6d86 MessageTray: use boxpointer for summary notification
https://bugzilla.gnome.org/show_bug.cgi?id=624900
2010-10-19 23:23:10 +04:00
Dan Winship
de16108dff MessageTray: untangle click notifications
Previously, when you clicked on a notification, it would call
this.source.clicked(), which would emit a 'clicked' signal on the
source, and then various other stuff would happen from there. This
used to make a little bit of sense, when clicking on a notification
was supposed to do the same thing as clicking on its source, but makes
less sense now, when clicking on the source itself *doesn't* call
source.clicked()...

Change it so that when you click on a notification, the notification
emits 'clicked' itself, and the source notices that and calls its
notificationClicked() method, and the various source subclasses do
what they need to do with that, and Source no longer has a clicked
method/signal.

https://bugzilla.gnome.org/show_bug.cgi?id=631042
2010-10-12 17:21:58 -04:00
Dan Winship
0215a449ad MessageTray: fix wobbling during summaryitem animation
Redo the way that the summary item expand/collapse animation works so
that the items all resize in unison so that when moving from one to
another, the summary area as a whole stays a constant width rather
than wobbling slightly.

(Also rename all references to the "minimum" summary item title width,
since it's not a minimum, it's just the width.)

https://bugzilla.gnome.org/show_bug.cgi?id=630546
2010-10-11 11:51:56 -04:00
Marina Zhurakhinskaya
4e14f18a58 Add the banner to the body if the notification is expandable because it has an action area
This fixes the bug when the body would be missing from the expanded notification
that has a short body that used to fit in the one-line banner and is expandable
because it has action buttons.

We always want to add the banner to the body of an expandable notification,
unless the notification has custom content. We used to only do that when
creating this._scrollArea for the content. We should also do that when creating
this._actionArea .

https://bugzilla.gnome.org/show_bug.cgi?id=631566
2010-10-06 17:43:59 -04:00
Marina Zhurakhinskaya
b017a2187b Don't show the summary if a new item got removed before we had a chance to show it
It's possible that an item that was added to the summary got removed before
we had a chance to show the summary because the user has interacted with
the notification (e.g. clicked on an application ready notification). We should
not be showing the summary with an unchanged set of items in this case.

However, it is possible that multiple items were added to the summary before
we had a chance to show the summary, and only some of them got removed. In view
of this scenario, we can't just use a boolean flag to indicate if the summary
needs to be shown, but have to maintain an array of new summary items instead.

https://bugzilla.gnome.org/show_bug.cgi?id=630939
2010-10-05 16:14:05 -04:00
Florian Müllner
109de6a356 messageTray: Do not show the summary when removing a source
Having the summary pop up automatically after a source icon has been
removed is pretty useless ("Hey, there was something interesting going
on, but you missed it and it's gone now, kthxbye").

https://bugzilla.gnome.org/show_bug.cgi?id=630939
2010-09-29 23:11:24 +02:00
Dan Winship
a6e4bab990 Add symbolic icons to TextureCache's load_icon_name()
Icons can be loaded as St.Icon.SYMBOLIC, FULLCOLOR, APPLICATION or
DOCUMENT. The first will look for a symbolic equivalent, the second
looks for a full-color version (and does fallback, eg, from
"drive-harddisk-usb" to "drive-harddisk"). APPLICATION and DOCUMENT do
full-color icons without fallback (as specified by the icon spec).

And update various callers to use the right flags.

Based on a patch from Matt Novenstern.

https://bugzilla.gnome.org/show_bug.cgi?id=621311
2010-09-24 10:57:27 -04:00
Dan Winship
82e6f9c8d6 [MessageTray] show newly-added sources even if they don't post notifications
eg, when a trayicon is added, show the summary briefly

https://bugzilla.gnome.org/show_bug.cgi?id=608869
2010-09-23 09:49:47 -04:00
Dan Winship
828ad348ce [MessageTray] fix allocation in the title-too-long case
Previously we were hiding the banner label if the title was too long,
but this causes queue_relayout() warnings. Instead, just set its
opacity to 0.

https://bugzilla.gnome.org/show_bug.cgi?id=629308
2010-09-21 08:12:34 -04:00
Marina Zhurakhinskaya
afd3b76970 Fix various details of how notifications are shown
This patch ensures the following notifications behavior:
- Urgent notifications that have long title or banner text are auto-expanded
  correctly.
- Single-line notifications that have _expandNotification() called (e.g.
  because the user mouses over to them), are treated as expanded, which means
  they get fully expanded if they are updated with more content and the user
  can escape them.
- The position of expanded notifications is updated when they are updated.
- Notification banner is shown again on the first line if it can fully fit
  there after a notification is updated, even if it was previously hidden
  because the notification was expanded and the old banner did not fully fit.
- New notifications are immediately hidden if the user mouses away from them.
- If a new notification is updated while it is shown, we extend the time it
  will be shown.
- If a new notification is updated while it is hiding, we stop hiding it and
  show it again.
- If a summary notification is updated while it is hiding, we let it finish
  hiding and show a new notification with the updated information.

Implementation details:
- Single-line notifications now have 4px bottom padding instead of 8px, which
  means that their height matches the tray height, they are fully shown in the
  banner mode, and don't pop out by 4px when the notification is expanded.
- Notification keeps a flag that indicates whether it is expanded, updates
  its expanded look when it is updated, and emits an 'expanded' signal
  indicating that its layout has possibly changed. The message tray connects
  to this 'expanded' signal when it is showing a notification in the expanded
  state and updates the position of the notification accordingly when this
  signal is received so that the notification is fully shown. This is better
  than connecting to 'notify::height' signal on the notification bin, since
  it results in fewer callbacks.

https://bugzilla.gnome.org/show_bug.cgi?id=617209
2010-09-10 15:47:12 -04:00
Marina Zhurakhinskaya
6d2d4fcc77 Don't expand notifications that pop up over the pointer
Expanding notifications automatically just because they popped up where
the pointer is positioned distracts the user. It can also lead to a behavior
that is surprising to the user by, for example, making the user's input
switch to the notification's text entry box.

It is possible to expand a notification that popped up over the pointer
by mousing away from it and then mousing back in immediately.

https://bugzilla.gnome.org/show_bug.cgi?id=617209
2010-09-02 14:48:36 -04:00
Marina Zhurakhinskaya
a25f7df626 Fully show long titles when a notification is expanded
We used to keep long titles ellipsized when a notification was expanded,
which was a bug. We now show them fully by line wrapping them.

Based on the original patch from Steven Van Bael.

https://bugzilla.gnome.org/show_bug.cgi?id=623970
2010-08-31 13:47:17 -04:00
Marina Zhurakhinskaya
f8dc3b88f8 Use 'customContent' flag instead of 'bannerBody'
We used 'bannerBody' flag to differentiate the case when we move the banner to
the body when the notification is expanded from the one when we don't do that
and only use the custom content set for the notification, as is the case for
Telepathy notifications. We also always cleared the content of the notification
on update when bannerBody was set to true.

Flag named 'customContent' reflects the use case for it more clearly. The
comments that accompany it were also updated and improved.

We now always add the banner text as the first element in the expanded
notification unless 'customContent' flag is set to true.

If the 'body' parameter is specified, we use it in addition to the banner
text. The earlier version of the code had a bug that resulted in the 'body'
parameter not being set only in the case when the 'bannerBody' was set to
true and the banner text had newlines in it.

https://bugzilla.gnome.org/show_bug.cgi?id=623970
2010-08-31 13:47:10 -04:00
Marina Zhurakhinskaya
539b8ae9f6 Don't show the banner when hiding the notification or showing it in the summary mode
The banner should not be appearing briefly when we are hiding the notification.
For that, we should only restore the opacity of the banner in popInCompleted()
when we are done hiding the notification. We do need to restore the opacity
in case the notification is updated and is shown in the banner mode again.

The banner should not be appearing briefly when we are showing the notification
in the summary mode. For that, we should not use the animation time to fade out
the banner in popOut() for summary notifications.

These two problems were particularly visible when the ANIMATION_TIME was increased.

https://bugzilla.gnome.org/show_bug.cgi?id=623970
2010-08-31 13:47:01 -04:00
Marina Zhurakhinskaya
93d3270566 Calculate whether we need an expansion row for the banner correctly
The old calculation did not take into account the icon and the spacing
between columns. This resulted in the notifications that had a slightly
longer title/banner combination than could actually fit not being expandable.

The new calculation is done in _bannerBoxAllocate() so
that we don't need to hardcode which other elements are present.

https://bugzilla.gnome.org/show_bug.cgi?id=627985
2010-08-26 16:07:51 -04:00
Dan Winship
6f57f07214 [MessageTray] Clean up source-vs-notification icon handling
A Source needs exactly one summary icon (which in the case of a
trayicon-based source won't even be just an image), but possibly many
notification icons, which may vary for successive notifications
(particularly in the case of NotificationDaemon notifications). So
differentiate these cases in the API.

https://bugzilla.gnome.org/show_bug.cgi?id=627303
2010-08-26 11:00:54 -04:00
Dan Winship
1951812a47 [MessageTray] use Params.parse in Notification
https://bugzilla.gnome.org/show_bug.cgi?id=627303
2010-08-26 10:52:01 -04:00