Exemplo n.º 1
0
static void
st_scroll_bar_set_property (GObject      *gobject,
                            guint         prop_id,
                            const GValue *value,
                            GParamSpec   *pspec)
{
  StScrollBar *bar = ST_SCROLL_BAR (gobject);

  switch (prop_id)
    {
    case PROP_ADJUSTMENT:
      st_scroll_bar_set_adjustment (bar, g_value_get_object (value));
      break;

    case PROP_VERTICAL:
      bar->priv->vertical = g_value_get_boolean (value);
      if (bar->priv->vertical)
        clutter_actor_set_name (CLUTTER_ACTOR (bar->priv->handle),
                                "vhandle");
      else
        clutter_actor_set_name (CLUTTER_ACTOR (bar->priv->handle),
                                "hhandle");
      clutter_actor_queue_relayout ((ClutterActor*) gobject);
      break;

    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
      break;
    }
}
static void
mpl_panel_background_allocate (ClutterActor          *actor,
                               const ClutterActorBox *box,
                               ClutterAllocationFlags flags)
{
  MplPanelBackgroundPrivate *priv = MPL_PANEL_BACKGROUND (actor)->priv;
#if 0
  ClutterActor              *border;

  border = mx_widget_get_border_image (MX_WIDGET (actor));

  /*
   * We need to use different background asset based on the size allocated to us
   * -- basically, the panel cannot be smaller than the size of the borders of
   * its border image (see MB#702), so if it is smaller than the current asset
   * allows, we change the asset to simpler one.
   *
   * The code here assumes that we either have no name, or are called
   * 'too-small', but since this is a private widget of libmeego-panel, we can
   * enforce this assumption.
   */
  if (border)
    {
      const gchar *name = clutter_actor_get_name (actor);
      gboolean     too_small = FALSE;

      /*
       * Get the dimensions of the base texture (we are guaranteed to be called
       * first with name == NULL, so this works).
       */
      if (!priv->base_geom_known && !name)
        {
          mx_texture_frame_get_border_values (/*MX_TEXTURE_FRAME*/ (border),
                                              &priv->base_t,
                                              &priv->base_r,
                                              &priv->base_b,
                                              &priv->base_l);

          priv->base_geom_known = TRUE;
        }

      if (priv->base_l + priv->base_r > box->x2 - box->x1 ||
          priv->base_t + priv->base_b > box->y2 - box->y1)
        {
          too_small = TRUE;
        }

      if (!name && too_small)
        {
          clutter_actor_set_name (actor, "too-small");
        }
      else if (name && !too_small)
        {
          clutter_actor_set_name (actor, NULL);
        }
    }
#endif //DV
  CLUTTER_ACTOR_CLASS (
             mpl_panel_background_parent_class)->allocate (actor, box, flags);
}
Exemplo n.º 3
0
static void
st_scroll_bar_init (StScrollBar *self)
{
  self->priv = ST_SCROLL_BAR_GET_PRIVATE (self);

  self->priv->trough = (ClutterActor *) st_bin_new ();
  clutter_actor_set_reactive ((ClutterActor *) self->priv->trough, TRUE);
  clutter_actor_set_name (CLUTTER_ACTOR (self->priv->trough), "trough");
  clutter_actor_add_child (CLUTTER_ACTOR (self),
                           CLUTTER_ACTOR (self->priv->trough));
  g_signal_connect (self->priv->trough, "button-press-event",
                    G_CALLBACK (trough_button_press_event_cb), self);
  g_signal_connect (self->priv->trough, "button-release-event",
                    G_CALLBACK (trough_button_release_event_cb), self);
  g_signal_connect (self->priv->trough, "leave-event",
                    G_CALLBACK (trough_leave_event_cb), self);

  self->priv->handle = (ClutterActor *) st_button_new ();
  clutter_actor_set_name (CLUTTER_ACTOR (self->priv->handle), "hhandle");
  clutter_actor_add_child (CLUTTER_ACTOR (self),
                           CLUTTER_ACTOR (self->priv->handle));
  g_signal_connect (self->priv->handle, "button-press-event",
                    G_CALLBACK (handle_button_press_event_cb), self);
  g_signal_connect (self->priv->handle, "button-release-event",
                    G_CALLBACK (handle_button_release_event_cb), self);
  g_signal_connect (self->priv->handle, "motion-event",
                    G_CALLBACK (handle_motion_event_cb), self);

  clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE);

  g_signal_connect (self, "notify::reactive",
                    G_CALLBACK (st_scroll_bar_notify_reactive), NULL);
}
static void
_update_placeholder_state (MnbPeoplePanel *self)
{
  MnbPeoplePanelPrivate *priv = GET_PRIVATE (self);
  gint accounts_available, accounts_online;

  g_object_get (priv->tp_feed,
                "accounts-available", &accounts_available,
                "accounts-online", &accounts_online,
                NULL);

  clutter_actor_set_name (priv->content_table, "people-panel-content-box");

  /* There is something in the model, hide all placeholders */
  if (clutter_model_get_first_iter (CLUTTER_MODEL (priv->model)))
  {
    clutter_actor_hide (priv->no_people_tile);
    clutter_actor_hide (priv->everybody_offline_tile);

    /* Ensure content stuff is visible */
    clutter_actor_show (priv->main_scroll_view);
    clutter_actor_show (priv->me_table);

    if (accounts_available > 0 && accounts_online == 0)
    {
      clutter_actor_show (priv->offline_banner);
    } else {
      clutter_actor_hide (priv->offline_banner);
    }
  } else {
    /* Hide real content stuff */
    clutter_actor_hide (priv->main_scroll_view);

    if (accounts_online == 0)
    {
      if (accounts_available == 0)
      {
        clutter_actor_set_name (priv->content_table,
                                "no-people-panel-content-box");
        clutter_actor_show (priv->no_people_tile);
        clutter_actor_hide (priv->me_table);
        clutter_actor_hide (priv->everybody_offline_tile);
        clutter_actor_hide (priv->offline_banner);
      } else {
        clutter_actor_show (priv->me_table);
        clutter_actor_show (priv->offline_banner);
        clutter_actor_hide (priv->no_people_tile);
        clutter_actor_hide (priv->everybody_offline_tile);
      }
    } else {
      clutter_actor_show (priv->me_table);
      clutter_actor_show (priv->everybody_offline_tile);
      clutter_actor_hide (priv->no_people_tile);
      clutter_actor_hide (priv->offline_banner);
    }
  }
}
Exemplo n.º 5
0
int
main (int   argc,
      char *argv[])
{
  ClutterActor *stage;
  ClutterAction *action1;
  ClutterAction *action2;
  ClutterActor *actor1;
  ClutterActor *actor2;

  if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
    return 1;

  stage = clutter_stage_new ();
  clutter_actor_set_size (stage, 400, 400);
  clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
  g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);

  actor1 = clutter_actor_new ();
  clutter_actor_set_name (actor1, "Red Button");
  clutter_actor_set_background_color (actor1, CLUTTER_COLOR_Red);
  clutter_actor_set_size (actor1, 100, 100);
  clutter_actor_set_reactive (actor1, TRUE);
  clutter_actor_set_position (actor1, 50, 150);
  clutter_actor_add_child (stage, actor1);

  actor2 = clutter_actor_new ();
  clutter_actor_set_name (actor2, "Blue Button");
  clutter_actor_set_background_color (actor2, CLUTTER_COLOR_Blue);
  clutter_actor_set_size (actor2, 100, 100);
  clutter_actor_set_position (actor2, 250, 150);
  clutter_actor_set_reactive (actor2, TRUE);
  clutter_actor_add_child (stage, actor2);

  action1 = clutter_click_action_new ();
  clutter_actor_add_action (actor1, action1);

  action2 = clutter_click_action_new ();
  clutter_actor_add_action (actor2, action2);

  g_signal_connect (action1,
                    "clicked",
                    G_CALLBACK (clicked_cb),
                    NULL);

  g_signal_connect (action2,
                    "clicked",
                    G_CALLBACK (clicked_cb),
                    NULL);

  clutter_actor_show (stage);

  clutter_main ();

  return EXIT_SUCCESS;
}
Exemplo n.º 6
0
IO_METHOD(IoClutterActor, setName) {
  clutter_actor_set_name(
    IOCACTOR(self),
    IoMessage_locals_cStringArgAt_(m, locals, 0)
  );
  return self;
}
Exemplo n.º 7
0
static void
mx_expander_update (MxExpander *expander)
{
  MxExpanderPrivate *priv = expander->priv;

  if (priv->expanded)
    {
      clutter_actor_set_name (priv->arrow, "mx-expander-arrow-open");
      mx_stylable_set_style_class (MX_STYLABLE (expander), "open-expander");
    }
  /* closed state is set when animation is finished */

  if (!priv->child)
    return;

  /* setup and start the expansion animation */
  if (!priv->expanded)
    {
      clutter_actor_hide (priv->child);
      clutter_timeline_set_direction (priv->timeline,
                                      CLUTTER_TIMELINE_BACKWARD);
    }
  else
    {
      clutter_timeline_set_direction (priv->timeline,
                                      CLUTTER_TIMELINE_FORWARD);
    }


  if (!clutter_timeline_is_playing (priv->timeline))
    clutter_timeline_rewind (priv->timeline);

  clutter_timeline_start (priv->timeline);
}
Exemplo n.º 8
0
static void
mx_expander_init (MxExpander *self)
{
  MxExpanderPrivate *priv = self->priv = GET_PRIVATE (self);

  priv->label = clutter_text_new ();
  clutter_actor_add_child ((ClutterActor *) self, priv->label);

  priv->arrow = (ClutterActor *) mx_icon_new ();
  clutter_actor_add_child ((ClutterActor*) self, priv->arrow);
  clutter_actor_set_name (priv->arrow, "mx-expander-arrow-closed");

  /* TODO: make this a style property */
  priv->spacing = 10.0f;

  priv->timeline = clutter_timeline_new (250);
  clutter_timeline_set_progress_mode (priv->timeline, CLUTTER_EASE_IN_SINE);
  g_signal_connect (priv->timeline, "new-frame", G_CALLBACK (new_frame), self);
  g_signal_connect (priv->timeline, "completed", G_CALLBACK (timeline_complete), self);


  clutter_actor_set_reactive ((ClutterActor *) self, TRUE);

  g_signal_connect (self, "style-changed",
                    G_CALLBACK (mx_expander_style_changed), NULL);

  g_signal_connect (self, "actor-added",
                    G_CALLBACK (mx_expander_actor_added), NULL);
  g_signal_connect (self, "actor-removed",
                    G_CALLBACK (mx_expander_actor_removed), NULL);
}
Exemplo n.º 9
0
static void
mex_telepathy_channel_create_incoming_video (MexTelepathyChannel *self)
{
  MexTelepathyChannelPrivate *priv = MEX_TELEPATHY_CHANNEL (self)->priv;

  ClutterActor *video_incoming_area;

  /* Setup the incoming surface to draw to */
  priv->incoming_texture = clutter_texture_new ();
  clutter_texture_set_keep_aspect_ratio (CLUTTER_TEXTURE (priv->incoming_texture),
                                         TRUE);

  video_incoming_area = mx_stack_new ();

  clutter_container_add (CLUTTER_CONTAINER (video_incoming_area),
                         mex_telepathy_channel_create_static_image(),
                         priv->incoming_texture,
                         NULL);

  /* Create a frame for it with a styled border */
  priv->full_frame = mx_frame_new();
  clutter_actor_set_name (priv->full_frame, "Incoming Frame");
  mx_bin_set_fill (MX_BIN (priv->full_frame), TRUE, TRUE);
  mx_stylable_set_style_class (MX_STYLABLE (priv->full_frame),
                               "CallWindow");
  clutter_actor_add_effect (priv->full_frame,
                            CLUTTER_EFFECT (
                              mex_telepathy_channel_create_shadow ()));
  clutter_container_add_actor (CLUTTER_CONTAINER (priv->full_frame),
                               video_incoming_area);

  priv->incoming_sink =
    clutter_gst_video_sink_new (CLUTTER_TEXTURE (priv->incoming_texture));
}
Exemplo n.º 10
0
static void
mnb_statusbar_init (MnbStatusbar *self)
{
  MnbStatusbarPrivate *priv;
  GDateTime *datetime;

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

  g_signal_connect (self,
                    "event",
                    G_CALLBACK (mnb_statusbar_event_cb),
                    NULL);

  priv->datetime = mx_button_new ();
  clutter_actor_set_name (priv->datetime, "statusbar-date-button");
  clutter_actor_set_parent (priv->datetime, CLUTTER_ACTOR (self));

  mnb_statusbar_update_datetime (self);

  datetime = g_date_time_new_now_local ();
  g_timeout_add_seconds (60 - g_date_time_get_second (datetime),
                         (GSourceFunc) mnb_statusbar_initial_timeout_cb,
                         self);
  g_date_time_unref (datetime);
}
int
main (int argc, char *argv[])
{
  ClutterActor *stage;
  ClutterActor *r1, *r2, *r3;

  if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
    return 1;

  stage = clutter_stage_new ();
  clutter_actor_set_size (stage, 300, 300);
  clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
  g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);

  r1 = clutter_rectangle_new_with_color (&red);
  clutter_actor_set_size (r1, 150, 150);
  clutter_actor_add_constraint (r1, clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.25));
  clutter_actor_add_constraint (r1, clutter_align_constraint_new (stage, CLUTTER_ALIGN_Y_AXIS, 0.25));
  clutter_actor_set_reactive (r1, TRUE);
  clutter_actor_set_name (r1, "red");

  r2 = clutter_rectangle_new_with_color (&green);
  clutter_actor_set_size (r2, 150, 150);
  clutter_actor_add_constraint (r2, clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.5));
  clutter_actor_add_constraint (r2, clutter_align_constraint_new (stage, CLUTTER_ALIGN_Y_AXIS, 0.5));
  clutter_actor_set_reactive (r2, TRUE);
  clutter_actor_set_depth (r2, -100);
  clutter_actor_set_name (r2, "green");

  r3 = clutter_rectangle_new_with_color (&blue);
  clutter_actor_set_size (r3, 150, 150);
  clutter_actor_add_constraint (r3, clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.75));
  clutter_actor_add_constraint (r3, clutter_align_constraint_new (stage, CLUTTER_ALIGN_Y_AXIS, 0.75));
  clutter_actor_set_opacity (r3, 125);
  clutter_actor_set_name (r3, "blue");

  clutter_container_add (CLUTTER_CONTAINER (stage), r1, r2, r3, NULL);

  g_signal_connect (r1, "motion-event", G_CALLBACK (_pointer_motion_cb), NULL);
  g_signal_connect (r2, "motion-event", G_CALLBACK (_pointer_motion_cb), NULL);

  clutter_actor_show (stage);

  clutter_main ();

  return 0;
}
Exemplo n.º 12
0
/* Setup various status icons */
static void init_icons(ClutterActor *stage)
{
	ClutterActor *rs_img;
	ClutterActor *ra_img;
	ClutterActor *shuffle_img;
	ClutterActor *play_img;
	ClutterActor *pause_img;

	rs_img = clutter_texture_new_from_file("icons/repeat-single.png", NULL);
	clutter_actor_set_name(rs_img, "rs_img");
	clutter_actor_set_size(rs_img, 20, 20);
	clutter_actor_set_position(rs_img, 430, 102);
	if (!mozart_get_repeat_single())
		clutter_actor_hide(rs_img);
	clutter_container_add_actor(CLUTTER_CONTAINER(stage), rs_img);

	ra_img = clutter_texture_new_from_file("icons/repeat-all.png", NULL);
	clutter_actor_set_name(ra_img, "ra_img");
	clutter_actor_set_size(ra_img, 20, 20);
	clutter_actor_set_position(ra_img, 430, 102);
	if (!mozart_get_repeat_all())
		clutter_actor_hide(ra_img);
	clutter_container_add_actor(CLUTTER_CONTAINER(stage), ra_img);

	shuffle_img = clutter_texture_new_from_file("icons/shuffle.png", NULL);
	clutter_actor_set_name(shuffle_img, "shuffle_img");
	clutter_actor_set_size(shuffle_img, 20, 20);
	clutter_actor_set_position(shuffle_img, 460, 102);
	if (!mozart_playlist_shuffled(NULL))
		clutter_actor_hide(shuffle_img);
	clutter_container_add_actor(CLUTTER_CONTAINER(stage), shuffle_img);

	play_img = clutter_texture_new_from_file("icons/playing.png", NULL);
	clutter_actor_set_name(play_img, "play_img");
	clutter_actor_set_size(play_img, 20, 20);
	clutter_actor_set_position(play_img, 400, 102);
	clutter_actor_hide(play_img);
	clutter_container_add_actor(CLUTTER_CONTAINER(stage), play_img);

	pause_img = clutter_texture_new_from_file("icons/paused.png", NULL);
	clutter_actor_set_name(pause_img, "pause_img");
	clutter_actor_set_size(pause_img, 20, 20);
	clutter_actor_set_position(pause_img, 400, 102);
	clutter_actor_hide(pause_img);
	clutter_container_add_actor(CLUTTER_CONTAINER(stage), pause_img);
}
Exemplo n.º 13
0
static ClutterActor *
_make_offline_banner (MnbPeoplePanel *pane,
                      gint            width)
{
  ClutterActor *tile;
  ClutterActor *tmp_text;
  ClutterActor *label, *bin;

  tile = mx_table_new ();
  mx_table_set_row_spacing (MX_TABLE (tile), 8);

  clutter_actor_set_width (tile, width);
  clutter_actor_set_name (tile,
                          "people-pane-you-offline-banner");
  label = mx_label_new_with_text (_("To see your IM contacts, "
                                    "you need to go online."));
  clutter_actor_set_name (label,
                          "people-pane-you-offline-label");
  tmp_text = mx_label_get_clutter_text (MX_LABEL (label));
  clutter_text_set_line_wrap (CLUTTER_TEXT (tmp_text), TRUE);
  clutter_text_set_line_wrap_mode (CLUTTER_TEXT (tmp_text),
                                   PANGO_WRAP_WORD_CHAR);
  clutter_text_set_ellipsize (CLUTTER_TEXT (tmp_text),
                              PANGO_ELLIPSIZE_NONE);

  bin = mx_frame_new ();
  mx_bin_set_child (MX_BIN (bin), (label));
  mx_bin_set_alignment (MX_BIN (bin), MX_ALIGN_START, MX_ALIGN_MIDDLE);
  mx_bin_set_fill (MX_BIN (bin), FALSE, TRUE);
  clutter_actor_set_name (bin,
                          "people-pane-you-offline-bin");

  mx_table_insert_actor_with_properties (MX_TABLE (tile),
                                         (ClutterActor *)bin,
                                         0,
                                         0,
                                         "x-expand", TRUE,
                                         "y-expand", FALSE,
                                         "x-fill", TRUE,
                                         "y-fill", FALSE,
                                         "x-align", MX_ALIGN_START,
                                         NULL);
  return tile;
}
Exemplo n.º 14
0
static void
mnb_launcher_button_init (MnbLauncherButton *self)
{
  ClutterActor *label;

  self->priv = MNB_LAUNCHER_BUTTON_GET_PRIVATE (self);

  g_signal_connect (self, "leave-event",
                    G_CALLBACK (_leave_event_cb), NULL);
  g_signal_connect (self, "key-focus-out",
                    G_CALLBACK (_leave_event_cb), NULL);
  g_signal_connect (self, "enter-event",
                    G_CALLBACK (_enter_event_cb), NULL);

  self->priv->icon = NULL;

  mx_stylable_set_style_class (MX_STYLABLE (self), "contentTile");

  /* "app" label */
  self->priv->title = (MxLabel *) mx_label_new ();
  mx_label_set_x_align (MX_LABEL (self->priv->title), MX_ALIGN_MIDDLE);

  clutter_actor_set_reactive (CLUTTER_ACTOR (self->priv->title), FALSE);
  mx_table_insert_actor_with_properties (MX_TABLE (self),
                                         CLUTTER_ACTOR (self->priv->title),
                                         1, 0,
                                         "x-align", MX_ALIGN_MIDDLE,
                                         "x-expand", TRUE,
                                         "x-fill", TRUE,
                                         "y-align", MX_ALIGN_MIDDLE,
                                         "y-expand", TRUE,
                                         "y-fill", TRUE,
                                         NULL);

  label = mx_label_get_clutter_text (self->priv->title);
  clutter_text_set_ellipsize (CLUTTER_TEXT (label), PANGO_ELLIPSIZE_END);
  clutter_text_set_line_alignment (CLUTTER_TEXT (label), PANGO_ALIGN_CENTER);
  clutter_text_set_line_wrap (CLUTTER_TEXT (label), TRUE);
  clutter_text_set_line_wrap_mode (CLUTTER_TEXT (label), PANGO_WRAP_WORD_CHAR);

  /* "fav app" toggle */
  self->priv->fav_toggle = g_object_ref_sink (CLUTTER_ACTOR (mx_button_new ()));
  mx_button_set_is_toggle (MX_BUTTON (self->priv->fav_toggle), TRUE);
  clutter_actor_set_name (CLUTTER_ACTOR (self->priv->fav_toggle),
                          "mnb-launcher-button-fav-toggle");
  clutter_actor_set_size (self->priv->fav_toggle, FAV_TOGGLE_SIZE, FAV_TOGGLE_SIZE);
  mx_table_insert_actor (MX_TABLE (self),
                         CLUTTER_ACTOR (self->priv->fav_toggle),
                         0, 0);


  g_signal_connect (self->priv->fav_toggle, "notify::toggled",
                    G_CALLBACK (fav_button_notify_toggled_cb), self);

  clutter_actor_set_reactive ((ClutterActor *) self, TRUE);
}
Exemplo n.º 15
0
static void
mpd_volume_tile_init (MpdVolumeTile *self)
{
  MpdVolumeTilePrivate *priv = GET_PRIVATE (self);
  ClutterActor  *icon;

  /* Layout */
  mx_box_layout_set_spacing (MX_BOX_LAYOUT (self), MPD_TILE_ICON_SPACING);

  icon = mx_icon_new ();
  clutter_actor_set_name (icon, "volume-off");
  mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (self),
                                           icon,
                                           -1,
                                           "y-fill", FALSE,
                                           NULL);

  priv->volume_slider = mx_slider_new ();
  mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (self),
                                           priv->volume_slider,
                                           -1,
                                           "expand", TRUE,
                                           NULL);
  g_signal_connect (priv->volume_slider, "notify::value",
                    G_CALLBACK (_volume_slider_value_notify_cb), self);

  icon = mx_icon_new ();
  clutter_actor_set_name (icon, "volume-on");
  mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (self),
                                           icon,
                                           -1,
                                           "y-fill", FALSE,
                                           NULL);

  /* Control */
  priv->control = gvc_mixer_control_new (MIXER_CONTROL_NAME);
  g_signal_connect (priv->control, "default-sink-changed",
                    G_CALLBACK (_mixer_control_default_sink_changed_cb), self);
  g_signal_connect (priv->control, "ready",
                    G_CALLBACK (_mixer_control_ready_cb), self);
  gvc_mixer_control_open (priv->control);
}
Exemplo n.º 16
0
static ClutterActor *
_make_everybody_offline_tile (MnbPeoplePanel *pane)
{
  ClutterActor *tile;
  ClutterActor *label, *bin;
  ClutterActor *tmp_text;

  tile = mx_table_new ();
  mx_table_set_row_spacing (MX_TABLE (tile), 8);

  clutter_actor_set_name ((ClutterActor *)tile,
                          "people-pane-everybody-offline-tile");
  label = mx_label_new_with_text (_("Sorry, we can't find any people. " \
                                    "It looks like they are all offline."));
  clutter_actor_set_name ((ClutterActor *)label,
                          "people-pane-everybody-offline-label");
  tmp_text = mx_label_get_clutter_text (MX_LABEL (label));
  clutter_text_set_line_wrap (CLUTTER_TEXT (tmp_text), TRUE);
  clutter_text_set_line_wrap_mode (CLUTTER_TEXT (tmp_text),
                                   PANGO_WRAP_WORD_CHAR);
  clutter_text_set_ellipsize (CLUTTER_TEXT (tmp_text),
                              PANGO_ELLIPSIZE_NONE);

  bin = mx_frame_new ();
  mx_bin_set_child (MX_BIN (bin), label);
  mx_bin_set_alignment (MX_BIN (bin), MX_ALIGN_START, MX_ALIGN_MIDDLE);
  mx_bin_set_fill (MX_BIN (bin), FALSE, TRUE);
  clutter_actor_set_name (bin,
                          "people-pane-everybody-offline-bin");

  mx_table_insert_actor_with_properties (MX_TABLE (tile),
                                         (ClutterActor *)bin,
                                         0,
                                         0,
                                         "x-expand", TRUE,
                                         "y-expand", FALSE,
                                         "x-fill", TRUE,
                                         "y-fill", FALSE,
                                         "x-align", MX_ALIGN_START,
                                         NULL);
  return tile;
}
static ClutterActor *
_make_messenger_launcher_tile (MnbPeoplePanel *panel)
{
  ClutterActor *table;
  ClutterActor *icon_tex;
  ClutterActor *button;
  GAppInfo *app_info;
  gchar *button_str;
  ClutterActor *bin;

  bin = mx_frame_new ();
  clutter_actor_set_name (bin, "people-panel-messenger-launcher-tile");
  table = mx_table_new ();
  mx_bin_set_child (MX_BIN (bin), table);
  mx_table_set_column_spacing (MX_TABLE (table), 16);
  app_info = (GAppInfo *)g_desktop_app_info_new ("empathy.desktop");

  icon_tex = g_object_new (MX_TYPE_ICON,
                           "icon-name", "netbook-empathy",
                           NULL);

  mx_table_add_actor_with_properties (MX_TABLE (table),
                                      icon_tex,
                                      0, 0,
                                      "x-expand", FALSE,
                                      "y-expand", TRUE,
                                      "x-fill", FALSE,
                                      "y-fill", FALSE,
                                      NULL);

  button_str = g_strdup_printf (_("Open %s"),
                                g_app_info_get_name (app_info));

  button = mx_button_new_with_label (button_str);
  g_free (button_str);
  g_signal_connect (button,
                    "clicked",
                    (GCallback)_messenger_launcher_button_clicked_cb,
                    panel);

  mx_table_add_actor_with_properties (MX_TABLE (table),
                                      button,
                                      0, 1,
                                      "x-expand", FALSE,
                                      "y-expand", TRUE,
                                      "x-fill", FALSE,
                                      "y-fill", FALSE,
                                      NULL);

  g_object_unref (app_info);

  return bin;
}
Exemplo n.º 18
0
int main(int argc, char **argv)
{
	ClutterActor *stage;
	ClutterColor stage_clr = { 0x00, 0x00, 0x00, 0xff };
	const gchar *stage_title = { "potassium music player" };
	struct sigaction action;

	g_set_application_name("potassium music player");

	clutter_init(&argc, &argv);
	
	stage = clutter_stage_get_default();
	clutter_actor_set_size(stage, 512, 128);
	clutter_stage_set_color(CLUTTER_STAGE(stage), &stage_clr);
	clutter_stage_set_title(CLUTTER_STAGE(stage), stage_title);
	clutter_actor_set_name(stage, "stage");
	clutter_actor_show(stage);

	/* Setup signal handler for USR1 to dump player state */
	memset(&action, 0, sizeof(&action));
	sigemptyset(&action.sa_mask);
	action.sa_handler = dump_data;
	action.sa_flags = SA_RESTART;
	sigaction(SIGUSR1, &action, NULL);

	/* Handle keyboard/mouse events */
	g_signal_connect(stage, "event", G_CALLBACK(input_events_cb), NULL);

	mozart_init(argc, argv);
	
	if (argc == 2) {
		/*
		 * strdup() argv[1] here, as it seems to get mangled by
		 * generate_playlist()
		 */
		generate_playlist(strdup(argv[1]), strdup(argv[1]));
		mozart_switch_playlist(argv[1]);
	} else {
		read_checkpoint_data();
	}

	init_icons(stage);

	g_timeout_add(500, (GSourceFunc)update_display, stage);
	g_timeout_add_seconds(1, (GSourceFunc)write_checkpoint_data, NULL);
	g_signal_connect(mozart_bus, "message::state-changed",
					G_CALLBACK(set_status_icons), stage);
	
	clutter_main();

	mozart_destroy();
	exit(0);
}
Exemplo n.º 19
0
Arquivo: mx-slider.c Projeto: 3v1n0/mx
static void
mx_slider_init (MxSlider *self)
{
  MxSliderPrivate *priv;

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

  g_signal_connect (self, "style-changed",
                    G_CALLBACK (mx_slider_style_changed_cb), NULL);

  priv->trough_bg = CLUTTER_ACTOR (_mx_progress_bar_fill_new ());
  clutter_actor_set_name (priv->trough_bg, "trough-background");
  clutter_actor_set_reactive (priv->trough_bg, TRUE);
  clutter_actor_add_child (CLUTTER_ACTOR (self), priv->trough_bg);
  g_signal_connect (priv->trough_bg, "button-press-event",
                    G_CALLBACK (on_trough_bg_button_press_event), self);
  g_signal_connect (priv->trough_bg, "button-release-event",
                    G_CALLBACK (on_trough_bg_button_release_event), self);
  g_signal_connect (priv->trough_bg, "leave-event",
                    G_CALLBACK (on_trough_bg_leave_event), self);

  priv->fill = CLUTTER_ACTOR (_mx_progress_bar_fill_new ());
  clutter_actor_set_name (priv->fill, "fill");
  clutter_actor_add_child (CLUTTER_ACTOR (self), priv->fill);

  priv->trough = CLUTTER_ACTOR (mx_frame_new ());
  clutter_actor_set_name (priv->trough, "trough");
  clutter_actor_add_child (CLUTTER_ACTOR (self), priv->trough);

  self->priv->handle = CLUTTER_ACTOR (mx_button_new ());
  clutter_actor_set_name (priv->handle, "handle");
  clutter_actor_add_child (CLUTTER_ACTOR (self), priv->handle);
  g_signal_connect (priv->handle, "button-press-event",
                    G_CALLBACK (on_handle_button_press_event), self);

  priv->buffer = _mx_progress_bar_fill_new ();
  clutter_actor_set_name (priv->buffer, "buffer");
  clutter_actor_add_child (CLUTTER_ACTOR (self), priv->buffer);
}
void
mnp_clock_tile_refresh (MnpClockTile *tile, time_t now, gboolean tfh)
{
	MnpDateFormat *fmt;

	tile->priv->time_now = now;
	fmt = mnp_format_time_from_location (tile->priv->loc, tile->priv->time_now, tfh);

	mx_label_set_text ((MxLabel *)tile->priv->time, fmt->time);
	mx_label_set_text ((MxLabel *)tile->priv->date, fmt->date);
	clutter_actor_set_name ((ClutterActor *)tile->priv->time, fmt->day ? "ClockTileTimeDay" : "ClockTileTimeNight");

	FREE_DFMT(fmt);
}
Exemplo n.º 21
0
static ClutterActor *
make_status (DawatiStatusPanel *status_panel)
{
    ClutterActor *pane;
    ClutterActor *table;
    ClutterActor *label;

    status_panel->client = sw_client_new ();
#if 0
    pane = mps_feed_pane_new (status_panel->client,
                              sw_client_get_service (status_panel->client,
                                      "twitter"));
#endif

    table = mx_table_new ();
    mx_table_set_row_spacing (MX_TABLE (table), 6);
    clutter_actor_set_name (table, "status-panel");
    label = mx_label_new_with_text (_("Status"));
    clutter_actor_set_name (label, "status-panel-header-label");
    mx_table_add_actor_with_properties (MX_TABLE (table),
                                        label,
                                        0, 0,
                                        "x-expand", FALSE,
                                        "y-expand", FALSE,
                                        NULL);

    pane = mps_feed_switcher_new (status_panel->client);
    mx_table_add_actor_with_properties (MX_TABLE (table),
                                        pane,
                                        1, 0,
                                        "x-expand", TRUE,
                                        "y-expand", TRUE,
                                        "x-fill", TRUE,
                                        "y-fill", TRUE,
                                        NULL);
    return table;
}
Exemplo n.º 22
0
static ClutterActor *
make_bouncer (const ClutterColor *base_color,
              gfloat              width,
              gfloat              height)
{
  ClutterActor *retval;
  cairo_t *cr;
  cairo_pattern_t *pattern;
  gfloat radius = MAX (width, height);

  retval = clutter_cairo_texture_new (width, height);

  cr = clutter_cairo_texture_create (CLUTTER_CAIRO_TEXTURE (retval));

  cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
  cairo_paint (cr);
  cairo_set_operator (cr, CAIRO_OPERATOR_ADD);

  cairo_arc (cr, radius / 2, radius / 2, radius / 2, 0.0, 2.0 * G_PI);

  pattern = cairo_pattern_create_radial (radius / 2, radius / 2, 0,
                                         radius, radius, radius);
  cairo_pattern_add_color_stop_rgba (pattern,
                                     0,
                                     base_color->red / 255.0,
                                     base_color->green / 255.0,
                                     base_color->blue / 255.0,
                                     base_color->alpha / 255.0);
  cairo_pattern_add_color_stop_rgba (pattern,
                                     0.9,
                                     base_color->red / 255.0,
                                     base_color->green / 255.0,
                                     base_color->blue / 255.0,
                                     0.1);

  cairo_set_source (cr, pattern);
  cairo_fill_preserve (cr);

  cairo_pattern_destroy (pattern);
  cairo_destroy (cr);

  clutter_actor_set_name (retval, "bouncer");
  clutter_actor_set_size (retval, width, height);
  clutter_actor_set_anchor_point (retval, width / 2, height / 2);
  clutter_actor_set_reactive (retval, TRUE);

  return retval;
}
Exemplo n.º 23
0
/**
 * clutter_test_get_stage:
 *
 * Retrieves the #ClutterStage used for testing.
 *
 * Return value: (transfer none): the stage used for testing
 *
 * Since: 1.18
 */
ClutterActor *
clutter_test_get_stage (void)
{
  g_assert (test_environ != NULL);

  if (test_environ->stage == NULL)
    {
      /* create a stage, and ensure that it goes away at the end */
      test_environ->stage = clutter_stage_new ();
      clutter_actor_set_name (test_environ->stage, "Test Stage");
      g_object_add_weak_pointer (G_OBJECT (test_environ->stage),
                                 (gpointer *) &test_environ->stage);
    }

  return test_environ->stage;
}
Exemplo n.º 24
0
static void
timeline_complete (ClutterTimeline *timeline,
                   ClutterActor    *expander)
{
  guchar opacity;
  MxExpanderPrivate *priv = MX_EXPANDER (expander)->priv;

  g_signal_emit (expander, expander_signals[EXPAND_COMPLETE], 0);

  /* if the expander is now closed, update the style */
  if (!priv->expanded)
    {
      clutter_actor_set_name (priv->arrow, "mx-expander-arrow-closed");
      mx_stylable_set_style_class (MX_STYLABLE (expander), "closed-expander");

      clutter_actor_queue_relayout (expander);
    }

  if (!priv->child)
    return;

  /* continue only if we are "opening" */
  if (!priv->expanded)
    return;

  /* we can't do an animation if there is already one in progress,
   * because we cannot get the actors original opacity */
  if (clutter_actor_get_transition (priv->child, "opacity"))
    {
      clutter_actor_show (priv->child);
      return;
    }

  opacity = clutter_actor_get_opacity (priv->child);
  clutter_actor_set_opacity (priv->child, 0);

  clutter_actor_show (priv->child);

  clutter_actor_save_easing_state (priv->child);
  clutter_actor_set_easing_mode (priv->child, CLUTTER_EASE_IN_SINE);
  clutter_actor_set_easing_duration (priv->child, 100);
  clutter_actor_set_opacity (priv->child, opacity);
  clutter_actor_restore_easing_state (priv->child);
}
Exemplo n.º 25
0
/**
 * mx_toolbar_set_has_close_button:
 * @toolbar: A #MxToolbar
 * @has_close_button: #TRUE if a close button should be displayed
 *
 * Set the #MxToolbar:has-close-button property
 *
 */
void
mx_toolbar_set_has_close_button (MxToolbar *toolbar,
                                 gboolean   has_close_button)
{
  MxToolbarPrivate *priv;

  g_return_if_fail (MX_IS_TOOLBAR (toolbar));

  priv = toolbar->priv;

  if (priv->has_close_button != has_close_button)
    {
      priv->has_close_button = has_close_button;

      if (!has_close_button)
        {
          if (priv->close_button)
            {
              clutter_actor_destroy (priv->close_button);
              priv->close_button = NULL;
            }
        }
      else
        {
          priv->close_button = mx_button_new ();
          clutter_actor_set_name (priv->close_button, "close-button");
          clutter_actor_add_child (CLUTTER_ACTOR (toolbar),
                                   priv->close_button);
          g_signal_connect (priv->close_button, "clicked",
                            G_CALLBACK (close_button_click_cb), toolbar);
          mx_stylable_style_changed (MX_STYLABLE (priv->close_button),
                                     MX_STYLE_CHANGED_FORCE);
        }

      clutter_actor_queue_relayout (CLUTTER_ACTOR (toolbar));

      g_object_notify (G_OBJECT (toolbar), "has-close-button");
    }
}
static void
mpd_devices_pane_init (MpdDevicesPane *self)
{
  ClutterActor  *label;
  ClutterActor  *tile;

  mx_box_layout_set_orientation (MX_BOX_LAYOUT (self), MX_ORIENTATION_VERTICAL);
  clutter_actor_set_width (CLUTTER_ACTOR (self), MPD_DEVICES_PANE_WIDTH);

  label = mx_label_new_with_text (_("Other devices"));
  clutter_actor_set_name (label, "pane-label");
  clutter_container_add_actor (CLUTTER_CONTAINER (self), label);

  tile = mpd_devices_tile_new ();
  g_signal_connect (tile, "request-hide",
                    G_CALLBACK (_tile_request_hide_cb), self);
  g_signal_connect (tile, "request-show",
                    G_CALLBACK (_tile_request_show_cb), self);
  clutter_container_add_actor (CLUTTER_CONTAINER (self), tile);
  clutter_container_child_set (CLUTTER_CONTAINER (self), tile,
                               "expand", true,
                               NULL);
}
Exemplo n.º 27
0
G_MODULE_EXPORT int
test_egl_image_main (int argc, char **argv)
{
  static const ClutterColor stage_color = { 0x1f, 0x84, 0x56, 0xff };
  ClutterActor *stage;
  ClutterActor *texture;
  ClutterX11TexturePixmap *x11_texture;
  Window window;

  clutter_init (&argc, &argv);

  if (argc != 2)
    {
      g_printerr ("usage: clutter-test xid\n");
      return EXIT_FAILURE;
    }

  window = (Window)strtol (argv[1], NULL, 0);
  g_print ("Attempting to redirect window 0x%08x\n", (guint)window);

  stage = clutter_stage_get_default ();
  clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);

  texture = clutter_eglx_egl_image_new_with_window (window);
  x11_texture = CLUTTER_X11_TEXTURE_PIXMAP (texture);
  clutter_x11_texture_pixmap_set_automatic (x11_texture, TRUE);

  clutter_actor_set_name (texture, "EGL Image");
  clutter_container_add (CLUTTER_CONTAINER (stage), texture, NULL);

  clutter_actor_set_size (stage, 512, 512);
  clutter_actor_show (stage);

  clutter_main ();

  return EXIT_SUCCESS;
}
void
mnp_clock_area_add_tile (MnpClockArea *area, MnpClockTile *tile)
{

	clutter_actor_set_reactive ((ClutterActor *)tile, TRUE);
	clutter_actor_set_name ((ClutterActor *)tile, "ClockTile");
	clutter_container_add_actor ((ClutterContainer *)clutter_stage_get_default(), (ClutterActor *)tile);
	mx_draggable_set_axis (MX_DRAGGABLE (tile), MX_DRAG_AXIS_Y);
	mx_draggable_enable ((MxDraggable *)tile);
	clutter_actor_set_size ((ClutterActor *)tile, 230, 75);
	clutter_actor_set_depth ((ClutterActor *)tile, area->priv->position);
	area->priv->position += 0.05;
	clutter_actor_reparent ((ClutterActor *)tile, (ClutterActor *)area);
  	clutter_container_child_set (CLUTTER_CONTAINER (area),
                               (ClutterActor *)tile,
                               "expand", FALSE,
			       "y-fill", FALSE,
			       "x-fill", TRUE,
                               NULL);	
	g_ptr_array_add (area->priv->clock_tiles, tile);
	mnp_clock_tile_set_remove_cb (tile, (TileRemoveFunc)mnp_clock_tile_removed, (gpointer)area);

	g_signal_connect (tile, "drag-y-pos", G_CALLBACK(tile_drag_run), area);
}
Exemplo n.º 29
0
static ClutterActor *
create_scroll_actor (ClutterActor *stage)
{
  ClutterActor *scroll;
  ClutterAction *pan_action;

  /* our scrollable viewport */
  scroll = clutter_actor_new ();
  clutter_actor_set_name (scroll, "scroll");

  clutter_actor_add_constraint (scroll, clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0));
  clutter_actor_add_constraint (scroll, clutter_bind_constraint_new (stage, CLUTTER_BIND_SIZE, 0));

  clutter_actor_add_child (scroll, create_content_actor ());

  pan_action = clutter_pan_action_new ();
  clutter_pan_action_set_interpolate (CLUTTER_PAN_ACTION (pan_action), TRUE);
  g_signal_connect (pan_action, "pan", G_CALLBACK (on_pan), NULL);
  clutter_actor_add_action (scroll, pan_action);

  clutter_actor_set_reactive (scroll, TRUE);

  return scroll;
}
Exemplo n.º 30
0
Arquivo: main.c Projeto: aalex/jasm
ClutterActor * setup_camera_texture(ClutterActor *stage)
{
  ClutterActor     *texture;
  GstPipeline      *pipeline;
  GstElement       *videosrc0;
  GstElement       *flip0;
  GstElement       *colorspace0;
  GstElement       *alpha0;
  GstElement       *colorspace1;
  GstElement       *cluttersink0;
  GstElement       *videomixer;
  GstElement       *colorspacemix;
  GstElement       *multifilesrc;
  GstElement       *decodebin;
  GstElement       *colorspace;
  GstElement       *videoformat;
  GstElement       *deinterlace;

  /* We need to set certain props on the target texture currently for
   * efficient/corrent playback onto the texture (which sucks a bit)
  */
  texture = g_object_new(CLUTTER_TYPE_TEXTURE,
        "disable-slicing", TRUE,
        NULL);

  /* Set up pipeline */
  pipeline = GST_PIPELINE(gst_pipeline_new (NULL));

  if (option_videotestsrc)
    videosrc0 = gst_element_factory_make("videotestsrc", "videotestsrc0");
  else
    videosrc0 = gst_element_factory_make("gconfvideosrc", "gconfvideosrc0"); // or autovideosrc?
  // TODO: check if option_flip_horizontal
  flip0 = gst_element_factory_make("videoflip", "videoflip0");
  g_object_set(G_OBJECT (flip0), "method", 4, NULL); // GST_VIDEO_FLIP_METHOD_HORIZ
  colorspace0 = gst_element_factory_make("ffmpegcolorspace", "colorspace0");
  //colorspace1 = gst_element_factory_make("ffmpegcolorspace", "colorspace1");
  //alpha0 = gst_element_factory_make("alpha", "alpha0");
  //videomixer = gst_element_factory_make("videomixer", NULL);
  //colorspacemix = gst_element_factory_make("ffmpegcolorspace", NULL);
  //multifilesrc = gst_element_factory_make("multifilesrc", NULL);
  //decodebin = gst_element_factory_make("jpegdec", NULL);
  //colorspace = gst_element_factory_make("ffmpegcolorspace", NULL);
  videoformat = gst_element_factory_make("capsfilter", NULL);
  cluttersink0 = gst_element_factory_make("cluttersink", "cluttersink0");
  //deinterlace = gst_element_factory_make("deinterlace", NULL);
  
  //g_object_set(alpha0, "method", 3, NULL); // 1 -> ALPHA_METHOD_GREEN 3 -> ALPHA_METHOD_CUSTOM  
  //g_object_set(G_OBJECT (multifilesrc),"location",DEFAULT_IMAGE_PATH,NULL); 
  GstCaps *imagecaps = gst_caps_from_string ("video/x-raw-yuv,format=(fourcc)AYUV");
  g_object_set (videoformat,"caps",  
    imagecaps,
    NULL);
  g_object_set(cluttersink0, "texture", CLUTTER_TEXTURE(texture), NULL); 
  
  GstElement *tee0 = gst_element_factory_make("tee", "tee0");
  GstElement *queue0 = gst_element_factory_make("queue", "queue0");
  GstElement *queue1 = gst_element_factory_make("queue", "queue1");
  GstElement *queue2 = gst_element_factory_make("queue", "queue2");
  GstElement *xvimagesink0 = gst_element_factory_make("xvimagesink", "xvimagesink0");
  g_object_set(xvimagesink0, "force-aspect-ratio", TRUE, NULL);

  gst_bin_add_many(GST_BIN(pipeline), 
        videosrc0, 
        //alpha0, 
        colorspace0, 
        tee0, 
        flip0, 
        queue0, 
        queue1, 
        queue2, 
        //colorspace1, 
        cluttersink0, 
        xvimagesink0, 
        //videomixer, 
        //colorspacemix, 
       // multifilesrc, 
       // decodebin, 
        //colorspace, 
        videoformat, 
        //deinterlace,
        NULL); 

   //image branch 
   //link_or_die(multifilesrc,decodebin);  
   //link_or_die(decodebin,colorspace);  
   //link_or_die(colorspace,videoformat);  
   //link_or_die(videoformat,videomixer);  
  
   //link_or_die(videosrc0, deinterlace);
   link_or_die(videosrc0, colorspace0); 
   link_or_die(colorspace0, flip0); 
   link_or_die(flip0, queue2); 
   link_or_die(queue2, tee0); 
   if (! gst_element_link_pads(tee0, "src0", queue0, "sink")) 
     g_error("Could not link %s to %s.\n", "tee0", "queue0"); 
   if (! gst_element_link_pads(tee0, "src1", queue1, "sink")) 
     g_error("Could not link %s to %s.\n", "tee0", "queue1"); 
   link_or_die(queue0, cluttersink0); 
   //link_or_die(alpha0, videomixer); 
   //link_or_die(videomixer,colorspacemix); 
   //link_or_die(colorspacemix,cluttersink0); 
   link_or_die(queue1, xvimagesink0); 

  //saving objects for extrernal control
  //g_object_set_data (G_OBJECT (texture), "gstalpha", alpha0);
  //g_object_set_data (G_OBJECT (texture), "gstfile", multifilesrc);

  // TODO:
  // if (option_verbose)
  // {
  //   g_print("videosrc0 -- colorspace0 -- queue2 --  tee0 -- queue0 -- alpha0 -- cluttersink0\n");
  //   g_print("                                            -- queue1 -- xvimagesink0\n");
  // }

  gst_element_set_state(GST_ELEMENT(pipeline), GST_STATE_PLAYING);

  clutter_actor_set_name(texture, LIVEVIDEO_ACTOR);
  return texture;
}