Пример #1
0
static VALUE
rbclt_container_raise_child (int argc, VALUE *argv, VALUE self)
{
  ClutterContainer *container = CLUTTER_CONTAINER (RVAL2GOBJ (self));
  VALUE actor, sibling;

  rb_scan_args (argc, argv, "11", &actor, &sibling);

  clutter_container_raise_child (container,
                                 RVAL2GOBJ (actor),
                                 RVAL2GOBJ (sibling));

  return self;
}
Пример #2
0
/**
 * clutter_box_pack_after:
 * @box: a #ClutterBox
 * @actor: a #ClutterActor
 * @sibling: (allow-none): a #ClutterActor or %NULL
 * @first_property: the name of the first property to set, or %NULL
 * @Varargs: a list of property name and value pairs, terminated by %NULL
 *
 * Adds @actor to @box, placing it after @sibling, and sets layout
 * properties at the same time, if the #ClutterLayoutManager used by
 * @box supports them
 *
 * If @sibling is %NULL then @actor is placed at the end of the
 * list of children, to be allocated and painted after every other child
 *
 * This function is a wrapper around clutter_container_add_actor(),
 * clutter_container_raise_child() and clutter_layout_manager_child_set()
 *
 * Since: 1.2
 */
void
clutter_box_pack_after (ClutterBox   *box,
                        ClutterActor *actor,
                        ClutterActor *sibling,
                        const gchar  *first_property,
                        ...)
{
  va_list var_args;

  g_return_if_fail (CLUTTER_IS_BOX (box));
  g_return_if_fail (CLUTTER_IS_ACTOR (actor));
  g_return_if_fail (sibling == NULL || CLUTTER_IS_ACTOR (sibling));

  clutter_container_add_actor (CLUTTER_CONTAINER (box), actor);
  clutter_container_raise_child (CLUTTER_CONTAINER (box), actor, sibling);

  if (first_property == NULL || *first_property == '\0')
    return;

  va_start (var_args, first_property);
  clutter_box_set_property_valist (box, actor, first_property, var_args);
  va_end (var_args);
}
static void
_source_notification_added_cb (MexNotificationSource *source,
                               MexNotification       *notification,
                               MexNotificationArea   *area)
{
    MexNotificationAreaPrivate *priv = GET_PRIVATE (area);
    ClutterActor *actor;
    ClutterActor *last_top_actor;
    ClutterAnimation *animation;

    actor = _make_notification_actor (notification);

    g_hash_table_insert (priv->notification_to_actor,
                         notification,
                         actor);

    clutter_container_add_actor (CLUTTER_CONTAINER (area),
                                 actor);
    mx_stack_child_set_x_fill (MX_STACK (area), actor, FALSE);
    mx_stack_child_set_y_fill (MX_STACK (area), actor, FALSE);
    mx_stack_child_set_x_align (MX_STACK (area), actor, MX_ALIGN_MIDDLE);
    mx_stack_child_set_y_align (MX_STACK (area), actor, MX_ALIGN_MIDDLE);

    /* Get the last notification since we want to fade that out */
    last_top_actor = g_queue_peek_head (priv->stack);

    g_queue_push_head (priv->stack, actor);

    clutter_container_raise_child (CLUTTER_CONTAINER (area),
                                   actor,
                                   last_top_actor);



    /* Fade out old notification */
    if (last_top_actor)
    {
        clutter_actor_animate (last_top_actor,
                               CLUTTER_EASE_OUT_QUAD,
                               350,
                               "opacity", 0x00,
                               NULL);
    }

    clutter_actor_set_opacity (actor, 0);
    animation = clutter_actor_animate (actor,
                                       CLUTTER_EASE_OUT_QUAD,
                                       350,
                                       "opacity", 0xff,
                                       NULL);

    /* Delay new notification fade in if we had an old one */
    if (last_top_actor)
    {
        ClutterTimeline *timeline;

        timeline = clutter_animation_get_timeline (animation);

        clutter_timeline_set_delay (timeline, 450);
    }

    g_object_set_data (G_OBJECT (actor),
                       "notification-area",
                       area);
    g_object_set_data (G_OBJECT (actor),
                       "notification",
                       notification);

    if (notification->duration > 0)
    {
        guint timeout_id =
            g_timeout_add_seconds (notification->duration,
                                   (GSourceFunc)_notification_timeout_cb,
                                   actor);

        g_hash_table_insert (priv->notification_to_timeout_id,
                             notification,
                             GINT_TO_POINTER (timeout_id));
    }
}