示例#1
0
static void
mex_content_box_set_context (MexContentView *view,
                             MexModel       *context)
{
  MexContentBox *box = MEX_CONTENT_BOX (view);
  MexContentBoxPrivate *priv = box->priv;

  if (priv->context == context)
    return;

  if (priv->context)
    g_object_unref (priv->context);

  priv->context = g_object_ref (context);
  mex_content_view_set_context (MEX_CONTENT_VIEW (priv->action_list), context);
  mex_content_view_set_context (MEX_CONTENT_VIEW (priv->tile), context);
  mex_content_view_set_context (MEX_CONTENT_VIEW (priv->info_panel), context);
}
示例#2
0
static void
mex_grilo_feed_open_default (MexGriloProgram *program, MexGriloFeed *feed)
{
  MexPlayer *player = mex_player_get_default ();

  mex_content_view_set_context (MEX_CONTENT_VIEW (player),
                                MEX_MODEL (feed));
  mex_content_view_set_content (MEX_CONTENT_VIEW (player),
                                MEX_CONTENT (program));
}
示例#3
0
static void
mex_content_box_set_context (MexContentView *view,
                             MexModel       *model)
{
  MexContentBox *box = MEX_CONTENT_BOX (view);
  MexContentBoxPrivate *priv = box->priv;

  if (priv->model == model)
    return;

  if (priv->model)
    g_object_unref (priv->model);

  priv->model = g_object_ref (model);
  mex_content_view_set_context (MEX_CONTENT_VIEW (priv->action_list), model);
}
示例#4
0
/**
 * mex_column_add_content:
 *
 * Add an item to the column for the specified content at the specified
 * position.
 */
static void
mex_column_add_content (MexColumn  *column,
                        MexContent *content,
                        guint       position)
{
  MexColumnPrivate *priv = column->priv;
  ClutterActor *box;
  MexShadow *shadow;
  ClutterColor shadow_color = { 0, 0, 0, 128 };
  GList *sibling;

  box = mex_content_box_new ();
  mex_content_view_set_content (MEX_CONTENT_VIEW (box), content);
  mex_content_view_set_context (MEX_CONTENT_VIEW (box), priv->model);

  sibling = g_list_nth (priv->children, position);
  priv->children = g_list_insert_before (priv->children, sibling, box);
  priv->n_items ++;

  /* add shadow */
  shadow = mex_shadow_new ();
  mex_shadow_set_paint_flags (shadow,
                              MEX_TEXTURE_FRAME_TOP
                              | MEX_TEXTURE_FRAME_BOTTOM);
  mex_shadow_set_radius_y (shadow, 25);
  mex_shadow_set_color (shadow, &shadow_color);
  clutter_actor_add_effect_with_name (CLUTTER_ACTOR (box), "shadow",
                                      CLUTTER_EFFECT (shadow));
  clutter_actor_meta_set_enabled (CLUTTER_ACTOR_META (shadow), FALSE);

  g_signal_connect (box, "notify::open",
                    G_CALLBACK (content_box_open_notify), column);

  /* set important if the column has focus */
  mex_content_box_set_important (MEX_CONTENT_BOX (box), priv->has_focus);

  clutter_actor_set_parent (box, CLUTTER_ACTOR (column));
}