コード例 #1
0
void
mex_content_box_get_thumbnail_size (MexContentBox *box,
                                    gint          *width,
                                    gint          *height)
{
  MexContentBoxPrivate *priv;

  g_return_if_fail (MEX_IS_CONTENT_BOX (box));

  priv = box->priv;

  if (width)
    *width = priv->thumb_width;
  if (height)
    *height = priv->thumb_height;
}
コード例 #2
0
void
mex_content_box_set_thumbnail_size (MexContentBox *box,
                                    gint           width,
                                    gint           height)
{
  MexContentBoxPrivate *priv;

  g_return_if_fail (MEX_IS_CONTENT_BOX (box));

  priv = box->priv;
  priv->thumb_width = width;
  priv->thumb_height = height;

  g_object_set (G_OBJECT (priv->tile),
                "thumb-width", priv->thumb_width,
                "thumb-height", priv->thumb_height,
                NULL);
}
コード例 #3
0
ファイル: mex-column.c プロジェクト: olethanh/media-explorer
static void
mex_column_add (ClutterContainer *container,
                ClutterActor     *actor)
{
  MexColumn *self = MEX_COLUMN (container);
  MexColumnPrivate *priv = self->priv;

  if (priv->sort_func)
    priv->children =
      g_list_insert_sorted_with_data (priv->children, actor,
                                      (GCompareDataFunc)priv->sort_func,
                                      priv->sort_data);
  else
    priv->children = g_list_append (priv->children, actor);

  priv->n_items ++;

  /* Expand/collapse any drawer that gets added as appropriate */
  if (MEX_IS_EXPANDER_BOX (actor))
    {
      g_signal_connect (actor, "notify::open",
                        G_CALLBACK (expander_box_open_notify), container);

      mex_expander_box_set_important (MEX_EXPANDER_BOX (actor),
                                      priv->has_focus);

      if (MEX_IS_CONTENT_BOX (actor))
        {
          ClutterActor *tile =
            mex_content_box_get_tile (MEX_CONTENT_BOX (actor));
          mex_tile_set_important (MEX_TILE (tile), priv->has_focus);
        }
    }

  clutter_actor_set_parent (actor, CLUTTER_ACTOR (self));

  g_signal_emit_by_name (self, "actor-added", actor);
}
コード例 #4
0
ファイル: mex-column.c プロジェクト: ocrete/media-explorer
static void
mex_column_expand_children (MexColumn    *column,
                            ClutterActor *start_at)
{
  MexColumnPrivate *priv = column->priv;
  guint offset, increment;
  GList *c;
  gchar **markers;
  gint i;
  gboolean start;

  if (priv->n_items < 1)
    return;

  /* Open/close boxes as appropriate */
  offset = 0;
  increment = 150;

  clutter_timeline_set_duration (priv->expand_timeline,
                                 priv->n_items * increment);

  clutter_timeline_set_delay (priv->expand_timeline, 350);

  /* remove the previous markers */
  markers = clutter_timeline_list_markers (priv->expand_timeline, -1, NULL);
  if (markers)
    {
      for (i = 0; markers[i]; i++)
        {
          clutter_timeline_remove_marker (priv->expand_timeline,
                                          markers[i]);
        }
    }
  g_strfreev (markers);

  /* start is TRUE if start_at is NULL, otherwise it is set to TRUE when the
   * start_at item is found */
  start = (start_at == NULL);

  for (c = priv->children; c; c = g_list_next (c))
    {
      gchar signal_name[32+16];
      ClutterActor *child = c->data;

      if (!MEX_IS_CONTENT_BOX (child))
        continue;

      mex_content_box_set_important (MEX_CONTENT_BOX (child), TRUE);
      mex_column_expand_child (child);

      /* continue until the start item has been found */
      if (child == start_at)
        start = TRUE;

      if (!start)
        continue;

      /* Note, 'marker-reached::' is 16 characters long */
      g_snprintf (signal_name, G_N_ELEMENTS (signal_name),
                  "marker-reached::%p", child);

      /* stagger opening */
      clutter_timeline_add_marker_at_time (priv->expand_timeline,
                                           signal_name + 16, offset);
      g_signal_connect_swapped (priv->expand_timeline, signal_name,
                                G_CALLBACK (mex_column_expand_child),
                                child);

      offset += increment;

    }

    clutter_timeline_start (priv->expand_timeline);
}
コード例 #5
0
ClutterActor *
mex_content_box_get_details (MexContentBox *box)
{
  g_return_val_if_fail (MEX_IS_CONTENT_BOX (box), NULL);
  return box->priv->panel;
}
コード例 #6
0
ClutterActor *
mex_content_box_get_menu (MexContentBox *box)
{
  g_return_val_if_fail (MEX_IS_CONTENT_BOX (box), NULL);
  return box->priv->action_list;
}
コード例 #7
0
ファイル: mex-column.c プロジェクト: olethanh/media-explorer
static void
mex_column_notify_focused_cb (MxFocusManager *manager,
                              GParamSpec     *pspec,
                              MexColumn      *self)
{
  GList *c;
  guint offset, increment;
  ClutterActor *focused, *focused_cell;
  gboolean cell_has_focus, has_focus, open, set_tile_important;

  MexColumnPrivate *priv = self->priv;

  focused = (ClutterActor *)mx_focus_manager_get_focused (manager);

  /* Check if we have focus, and what child is focused */
  focused_cell = NULL;
  set_tile_important = FALSE;
  cell_has_focus = has_focus = FALSE;

  if (focused)
    {
      gboolean contains_column = FALSE;
      ClutterActor *parent = clutter_actor_get_parent (focused);
      while (parent)
        {
          if (parent == (ClutterActor *)self)
            {
              has_focus = TRUE;

              if (!priv->has_focus)
                {
                  set_tile_important = TRUE;
                  priv->has_focus = TRUE;
                }

              if (focused != priv->header)
                {
                  cell_has_focus = TRUE;
                  focused_cell = focused;
                }

              break;
            }
          else if (MEX_IS_COLUMN (parent))
            {
              contains_column = TRUE;
            }

          focused = parent;
          parent = clutter_actor_get_parent (focused);
        }

      if (!contains_column)
        has_focus = TRUE;
    }

  if (!has_focus && priv->has_focus)
    {
      priv->has_focus = FALSE;
      set_tile_important = TRUE;
    }

  /* Scroll the adjustment to the top */
  if (!cell_has_focus && priv->adjustment)
    mx_adjustment_interpolate (priv->adjustment, 0, 250,
                               CLUTTER_EASE_OUT_CUBIC);

  /* Open/close boxes as appropriate */
  offset = 0;
  increment = 150;

  /* If we're changing the tile importance, initialise the state manager */
  if (set_tile_important && priv->n_items > 0)
    {
      if (priv->expand_timeline)
        g_object_unref (priv->expand_timeline);
      priv->expand_timeline =
        clutter_timeline_new (priv->n_items * increment);
      clutter_timeline_set_delay (priv->expand_timeline, 350);
    }

  /* Loop through children and set the expander box important/unimportant
   * as necessary, and if necessary, do the same for the tile inside the
   * expander-box.
   */
  open = has_focus && !cell_has_focus;
  for (c = priv->children; c; c = c->next)
    {
      gchar signal_name[32+16];
      ClutterActor *child = c->data;

      if ((!priv->collapse && priv->has_focus) || (child == focused_cell))
        open = TRUE;

      if (!MEX_IS_EXPANDER_BOX (child))
        continue;

      /* Note, 'marker-reached::' is 16 characters long */
      g_snprintf (signal_name, G_N_ELEMENTS (signal_name),
                  "marker-reached::%p", child);

      if (MEX_IS_CONTENT_BOX (child))
        {
          ClutterActor *tile =
            mex_content_box_get_tile (MEX_CONTENT_BOX (child));
          mex_tile_set_important (MEX_TILE (tile), priv->has_focus);
        }

      if (!open)
        {
          if (priv->expand_timeline)
            {
              if (clutter_timeline_has_marker (priv->expand_timeline,
                                               signal_name + 16))
                clutter_timeline_remove_marker (priv->expand_timeline,
                                                signal_name + 16);
              g_signal_handlers_disconnect_by_func (priv->expand_timeline,
                                                    mex_column_expand_drawer_cb,
                                                    child);
            }
          mex_expander_box_set_important (MEX_EXPANDER_BOX (child), FALSE);
        }
      else if (set_tile_important)
        {

          mex_expander_box_set_important (MEX_EXPANDER_BOX (child), FALSE);
          clutter_timeline_add_marker_at_time (priv->expand_timeline,
                                               signal_name + 16, offset);
          g_signal_connect_swapped (priv->expand_timeline, signal_name,
                                    G_CALLBACK (mex_column_expand_drawer_cb),
                                    child);

          offset += increment;
        }
      else
        mex_expander_box_set_important (MEX_EXPANDER_BOX (child), TRUE);
    }

  if (priv->expand_timeline && set_tile_important && (offset >= increment))
    clutter_timeline_start (priv->expand_timeline);
}