fix some stuff

This commit is contained in:
Tom Beckmann 2014-06-28 01:47:13 +02:00
parent f3fa2b79fc
commit fce1ba9bb6
4 changed files with 52 additions and 20 deletions

View File

@ -109,6 +109,7 @@ GALA_CORE_PKGS="gobject-2.0 >= $GLIB_MIN_VERSION \
granite \
libmutter >= $MUTTER_MIN_VERSION \
gee-0.8 \
dbus-glib-1 \
gnome-desktop-3.0 \
plank >= $PLANK_MIN_VERSION"

View File

@ -67,9 +67,7 @@ namespace Gala.Plugins.Notify
relevancy_time = new DateTime.now_local ().to_unix ();
width = WIDTH + MARGIN * 2;
reactive = true;
set_easing_duration (300);
set_easing_mode (AnimationMode.EASE_OUT_QUAD);
margin_left = 12;
summary_label = new Text.with_text (null, "");
summary_label.line_wrap = true;
@ -99,24 +97,21 @@ namespace Gala.Plugins.Notify
set_values ();
var transition = new TransitionGroup ();
transition.duration = 400;
transition.remove_on_complete = true;
save_easing_state ();
set_easing_duration (0);
x = WIDTH + MARGIN * 2;
restore_easing_state ();
var opacity_transition = new PropertyTransition ("opacity");
opacity_transition.set_from_value (0);
opacity_transition.set_to_value (255);
var slide_transition = new PropertyTransition ("y");
slide_transition.set_from_value (-60);
var slide_transition = new PropertyTransition ("x");
slide_transition.set_from_value (WIDTH);
slide_transition.set_to_value (0);
slide_transition.progress_mode = urgency == NotificationUrgency.LOW ?
AnimationMode.EASE_OUT_CUBIC : AnimationMode.EASE_OUT_BOUNCE;
AnimationMode.EASE_OUT_CUBIC : AnimationMode.EASE_OUT_BACK;
slide_transition.duration = 200;
slide_transition.remove_on_complete = true;
slide_transition.delay = 200;
transition.add_transition (opacity_transition);
transition.add_transition (slide_transition);
add_transition ("entry", transition);
add_transition ("entry", slide_transition);
var click = new ClickAction ();
click.clicked.connect (() => {
@ -136,10 +131,20 @@ namespace Gala.Plugins.Notify
public void close ()
{
set_easing_duration (200);
set_easing_mode (AnimationMode.EASE_IN_QUAD);
opacity = 0;
set_easing_mode (AnimationMode.EASE_IN_BACK);
x = WIDTH + MARGIN * 2;
being_destroyed = true;
get_transition ("opacity").completed.connect (() => destroy ());
var transition = get_transition ("x");
if (transition != null)
transition.completed.connect (() => destroy ());
else
destroy ();
}
Window? get_window ()

View File

@ -33,6 +33,7 @@ namespace Gala.Plugins.Notify
Object (screen: screen);
width = Notification.WIDTH + 2 * Notification.MARGIN;
clip_to_allocation = true;
}
public void show_notification (uint32 id, string summary, string body, Gdk.Pixbuf? icon,
@ -63,7 +64,11 @@ namespace Gala.Plugins.Notify
var notification = new Notification (screen, id, summary, body, icon,
urgency, expire_timeout, sender_pid, actions);
add_child (notification);
float height;
notification.get_preferred_height (Notification.WIDTH, out height, null);
update_positions (height);
insert_child_at_index (notification, 0);
animation_counter++;
@ -72,6 +77,27 @@ namespace Gala.Plugins.Notify
animations_changed (false);
});
}
void update_positions (float add_y = 0.0f)
{
var y = add_y;
var i = get_n_children ();
var delay_step = i > 0 ? 150 / i : 0;
foreach (var child in get_children ()) {
if (((Notification) child).being_destroyed)
continue;
child.save_easing_state ();
child.set_easing_mode (AnimationMode.EASE_OUT_BACK);
child.set_easing_duration (200);
child.set_easing_delay ((i--) * delay_step);
child.y = y;
child.restore_easing_state ();
y += child.height;
}
}
}
}

View File

@ -38,7 +38,7 @@ namespace Gala.Plugins.Notify
[DBus (name = "org.freedesktop.Notifications")]
public class NotifyServer : Object
{
const int DEFAULT_TMEOUT = 3000;
const int DEFAULT_TMEOUT = 4000;
const string FALLBACK_ICON = "dialog-information";
[DBus (visible = false)]