Exemplo n.º 1
0
static void
mex_content_box_init (MexContentBox *self)
{
  MexContentBoxPrivate *priv = self->priv = CONTENT_BOX_PRIVATE (self);
  ClutterActor *hline, *box;

  priv->thumb_width = 426;
  priv->thumb_height = 240;

  /* Create description panel */
  box = mx_box_layout_new ();
  mx_box_layout_set_orientation (MX_BOX_LAYOUT (box), MX_ORIENTATION_VERTICAL);

  hline = clutter_rectangle_new_with_color (&hline_color);
  clutter_actor_set_height (hline, 1);

  priv->panel = mex_info_panel_new (MEX_INFO_PANEL_MODE_SIMPLE);

  clutter_container_add (CLUTTER_CONTAINER (box), hline, priv->panel, NULL);


  /* monitor key press events */
  g_signal_connect (self, "key-press-event",
                    G_CALLBACK (mex_content_box_key_press_event_cb), self);

  /* Create tile */
  priv->tile = mex_content_tile_new ();
  g_object_set (G_OBJECT (priv->tile),
                "thumb-width", priv->thumb_width,
                "thumb-height", priv->thumb_height,
                NULL);
  mx_bin_set_fill (MX_BIN (priv->tile), TRUE, TRUE);

  clutter_actor_set_reactive (priv->tile, TRUE);
  g_signal_connect (priv->tile, "button-release-event",
                    G_CALLBACK (mex_content_box_tile_clicked_cb), self);

  /* Create secondary box for tile/menu */
  priv->box = mex_expander_box_new ();
  mex_expander_box_set_important (MEX_EXPANDER_BOX (priv->box), TRUE);
  mex_expander_box_set_grow_direction (MEX_EXPANDER_BOX (priv->box),
                                      MEX_EXPANDER_BOX_RIGHT);
  mex_expander_box_set_primary_child (MEX_EXPANDER_BOX (priv->box), priv->tile);

  /* Pack box and panel into self */
  mex_expander_box_set_primary_child (MEX_EXPANDER_BOX (self), priv->box);
  mex_expander_box_set_secondary_child (MEX_EXPANDER_BOX (self), box);

  /* Create the action list */
  priv->action_list = mex_action_list_new ();
  mex_expander_box_set_secondary_child (MEX_EXPANDER_BOX (priv->box),
                                        priv->action_list);

  /* Connect to the open notify signal */
  g_signal_connect (self, "notify::open",
                    G_CALLBACK (mex_content_box_notify_open_cb), NULL);
}
Exemplo n.º 2
0
static void
mex_content_box_init (MexContentBox *self)
{
  MexContentBoxPrivate *priv = self->priv = CONTENT_BOX_PRIVATE (self);
  ClutterActor *icon;

  clutter_actor_push_internal (CLUTTER_ACTOR (self));

  priv->info_panel = mex_info_panel_new (MEX_INFO_PANEL_MODE_SIMPLE);
  clutter_actor_set_parent (priv->info_panel, CLUTTER_ACTOR (self));

  /* monitor key press events */
  g_signal_connect (self, "key-press-event",
                    G_CALLBACK (mex_content_box_key_press_event_cb), NULL);

  /* Create tile */
  icon = mx_icon_new ();
  priv->tile = mex_content_tile_new ();
  clutter_actor_set_parent (priv->tile, CLUTTER_ACTOR (self));
  g_object_set (G_OBJECT (priv->tile),
                "thumb-width", DEFAULT_THUMB_WIDTH,
                "thumb-height", DEFAULT_THUMB_HEIGHT,
                NULL);
  mx_stylable_set_style_class (MX_STYLABLE (icon), "Info");
  mex_tile_set_secondary_icon (MEX_TILE (priv->tile), icon);


  clutter_actor_set_reactive (priv->tile, TRUE);
  g_signal_connect (priv->tile, "button-release-event",
                    G_CALLBACK (mex_content_box_tile_clicked_cb), self);

  /* Create the action list */
  priv->action_list = mex_action_list_new ();
  clutter_actor_set_parent (priv->action_list, CLUTTER_ACTOR (self));

  clutter_actor_pop_internal (CLUTTER_ACTOR (self));


  priv->timeline = clutter_timeline_new (200);
  priv->alpha = clutter_alpha_new_full (priv->timeline, CLUTTER_EASE_OUT_CUBIC);

  g_signal_connect_swapped (priv->timeline, "new-frame",
                            G_CALLBACK (clutter_actor_queue_relayout), self);
  g_signal_connect (priv->timeline, "completed",
                    G_CALLBACK (mex_content_box_timeline_completed), self);
}