Esempio n. 1
0
static void
mex_content_box_notify_key_focus_cb (ClutterStage  *stage,
                                     GParamSpec    *pspec,
                                     MexContentBox *self)
{
  MexContentBoxPrivate *priv = self->priv;
  ClutterActor *focus = clutter_stage_get_key_focus (stage);

  if (focus == priv->tile)
    {
      gboolean show_info;

      if (mex_content_get_metadata (priv->content,
                                    MEX_CONTENT_METADATA_SYNOPSIS) ||
          mex_content_get_metadata (priv->content,
                                    MEX_CONTENT_METADATA_DATE) ||
          mex_content_get_metadata (priv->content,
                                    MEX_CONTENT_METADATA_CREATION_DATE) ||
          mex_content_get_metadata (priv->content,
                                    MEX_CONTENT_METADATA_DURATION))
        show_info = TRUE;
      else
        {
          MexActionManager *manager = mex_action_manager_get_default ();
          GList *actions =
            mex_action_manager_get_actions_for_content (manager, priv->content);

          if (actions && actions->next)
            show_info = TRUE;
          else
            show_info = FALSE;

          g_list_free (actions);
        }

      if (show_info)
        {
          ClutterActor *icon = mx_icon_new ();
          mx_stylable_set_style_class (MX_STYLABLE (icon), "Info");
          mex_tile_set_secondary_icon (MEX_TILE (priv->tile), icon);
        }
    }
  else
    mex_tile_set_secondary_icon (MEX_TILE (priv->tile), NULL);
}
Esempio n. 2
0
static void
mex_tile_dispose (GObject *object)
{
  MexTile *self = MEX_TILE (object);
  MexTilePrivate *priv = self->priv;

  /* Use icon setting functions to remove icons */
  mex_tile_set_primary_icon (self, NULL);
  mex_tile_set_secondary_icon (self, NULL);

  if (priv->box_layout)
    {
      clutter_actor_destroy (priv->box_layout);
      priv->box_layout = NULL;

      /* box_layout contains label and secondary_label */
      priv->label = NULL;
      priv->secondary_label = NULL;
    }

  if (priv->header_padding)
    {
      g_boxed_free (MX_TYPE_PADDING, priv->header_padding);
      priv->header_padding = NULL;
    }

  if (priv->important_alpha)
    {
      g_object_unref (priv->important_alpha);
      priv->important_alpha = NULL;
    }

  if (priv->timeline)
    {
      clutter_timeline_stop (priv->timeline);
      g_object_unref (priv->timeline);
      priv->timeline = NULL;
    }

  if (priv->material)
    {
      cogl_object_unref (priv->material);
      priv->material = NULL;
    }

  G_OBJECT_CLASS (mex_tile_parent_class)->dispose (object);
}
Esempio n. 3
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);
}
Esempio n. 4
0
static void
mex_tile_set_property (GObject      *object,
                       guint         property_id,
                       const GValue *value,
                       GParamSpec   *pspec)
{
  MexTile *self = MEX_TILE (object);

  switch (property_id)
    {
    case PROP_PRIMARY_ICON:
      mex_tile_set_primary_icon (self, g_value_get_object (value));
      break;

    case PROP_SECONDARY_ICON:
      mex_tile_set_secondary_icon (self, g_value_get_object (value));
      break;

    case PROP_LABEL:
      mex_tile_set_label (self, g_value_get_string (value));
      break;

    case PROP_SECONDARY_LABEL:
      mex_tile_set_secondary_label (self, g_value_get_string (value));
      break;

    case PROP_HEADER_VISIBLE:
      mex_tile_set_header_visible (self, g_value_get_boolean (value));
      break;

    case PROP_IMPORTANT:
      mex_tile_set_important (self, g_value_get_boolean (value));
      break;

    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
    }
}