Exemplo n.º 1
0
int
main (int argc, char **argv)
{
  const ClutterColor grey = { 0x40, 0x40, 0x40, 0xff };

  ClutterActor *stage, *info_panel, *align;
  MxApplication *app;
  MxWindow *window;
  MexFeed *feed;
  MexProgram *program;

  mex_init (&argc, &argv);

  app = mx_application_new (&argc, &argv, "mex-info-panel-test", 0);
  mex_style_load_default ();

  window = mx_application_create_window (app);
  stage = (ClutterActor *) mx_window_get_clutter_stage (window);
  clutter_stage_set_color ((ClutterStage *) stage, &grey);

  align = g_object_new (MX_TYPE_FRAME, "x-align", MX_ALIGN_MIDDLE,
                        "y-align", MX_ALIGN_END, NULL);

  mx_window_set_child (window, align);

  info_panel = mex_info_panel_new (MEX_INFO_PANEL_MODE_FULL);
  mx_bin_set_child (MX_BIN (align), info_panel);

  mx_window_set_has_toolbar (window, FALSE);
  clutter_actor_set_size (stage, 1024, 768);

  feed = mex_feed_new ("source", "title");
  program =  mex_program_new (feed);

  mex_content_set_metadata (MEX_CONTENT (program),
                            MEX_CONTENT_METADATA_MIMETYPE,
                            "video/mp4");

  mex_content_set_metadata (MEX_CONTENT (program),
                            MEX_CONTENT_METADATA_TITLE,
                            "The cats on the moon");
  mex_content_set_metadata (MEX_CONTENT (program),
                            MEX_CONTENT_METADATA_SYNOPSIS,
                            "An original title where cats are sent to the moon to catch all the mice which are naturally attracted there due to the large consistency of cheese, this results in a space race between NASA and CATSA, leading to war on the moon over territory claimed by cats");
  mex_content_set_metadata (MEX_CONTENT (program),
                            MEX_CONTENT_METADATA_STILL,
                            "http://farm5.static.flickr.com/4013/4305303148_5cbc986a44_m.jpg");

  mex_content_view_set_content (MEX_CONTENT_VIEW (info_panel),
                                MEX_CONTENT (program));


  clutter_actor_show (stage);

  clutter_main ();

  return 0;
}
Exemplo n.º 2
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.º 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);
}
Exemplo n.º 4
0
static void
mex_player_init (MexPlayer *self)
{
  MexPlayerPrivate *priv;

  self->priv = priv = PLAYER_PRIVATE (self);

#ifdef USE_PLAYER_CLUTTER_GST
  priv->media = (ClutterMedia *) clutter_gst_video_texture_new ();

  /* We want to keep a reference to the media here to ensure consistency with
   * the D-BUS client interface behaviour
   */
  g_object_ref_sink (priv->media);

  clutter_container_add_actor (CLUTTER_CONTAINER (self),
                               CLUTTER_ACTOR (priv->media));
  clutter_texture_set_keep_aspect_ratio (CLUTTER_TEXTURE (priv->media), TRUE);
  clutter_container_child_set (CLUTTER_CONTAINER (self),
                               CLUTTER_ACTOR (priv->media),
                               "fit", TRUE, NULL);

  /* Use progressive download when possible. Don't enable that yet, the
   * behaviour of seeking in the non already downloaded part of the stream
   * is not great. Either disable seeking in that case or find out why.*/
#if 0
  video_texture = CLUTTER_GST_VIDEO_TEXTURE (priv->media);
  clutter_gst_video_texture_set_buffering_mode (video_texture,
						CLUTTER_GST_BUFFERING_MODE_DOWNLOAD);
#endif
#else
#ifdef USE_PLAYER_DBUS
  priv->media = (ClutterMedia *) mex_player_client_new ();
#else
#ifdef USE_PLAYER_SURFACE
  priv->media = (ClutterMedia *) mex_surface_player_new ();
#else
#error Unexpected player setup
#endif
#endif
#endif

  g_signal_connect (priv->media, "eos", G_CALLBACK (media_eos_cb), self);
  g_signal_connect (priv->media, "notify::playing",
                    G_CALLBACK (media_playing_cb), self);
  g_signal_connect (priv->media, "notify::progress",
                    G_CALLBACK (media_update_progress), self);


#if defined(USE_PLAYER_SURFACE) || defined (USE_PLAYER_CLUTTER_GST)
  {
    GError *error = NULL;
    priv->bridge = mex_media_dbus_bridge_new (priv->media);
    if (!mex_media_dbus_bridge_register (priv->bridge, &error))
      {
        g_warning (G_STRLOC ": Error registering player on D-BUS");
        g_clear_error (&error);
      }
  }
#endif

  /* add info panel */
  priv->info_panel = mex_info_panel_new (MEX_INFO_PANEL_MODE_FULL);
  mx_widget_set_disabled (MX_WIDGET (priv->info_panel), TRUE);
  clutter_container_add_actor (CLUTTER_CONTAINER (self), priv->info_panel);
  clutter_container_child_set (CLUTTER_CONTAINER (self), priv->info_panel,
                               "y-fill", FALSE, "y-align", MX_ALIGN_END,
                               NULL);
  clutter_actor_set_opacity (priv->info_panel, 0);

  /* add media controls */
  priv->controls = mex_media_controls_new ();
  g_signal_connect (priv->controls, "stopped", G_CALLBACK (controls_stopped_cb),
                    self);
  mex_media_controls_set_media (MEX_MEDIA_CONTROLS (priv->controls),
                                priv->media);
  clutter_container_add_actor (CLUTTER_CONTAINER (self), priv->controls);
  clutter_container_child_set (CLUTTER_CONTAINER (self), priv->controls,
                               "y-fill", FALSE, "y-align", MX_ALIGN_END,
                               NULL);

  priv->screensaver = mex_screensaver_new ();

  /* start in idle mode */
  mex_player_set_idle_mode (MEX_PLAYER (self), TRUE);
}