Beispiel #1
0
static void
notebook_button_cb (ClutterActor *button, GParamSpec *spec, Data *data)
{
  if (mx_button_get_toggled (MX_BUTTON (button)))
    {
      int i;

      for (i = 0; i < N_PAGES; i++)
        if (data->notebook_buttons[i] == button)
          mx_notebook_set_current_page (MX_NOTEBOOK (data->notebook),
                                        data->notebook_pages[i]);
        else
          mx_button_set_toggled (MX_BUTTON (button), FALSE);
    }
}
gboolean
mnb_launcher_button_get_favorite (MnbLauncherButton *self)
{
  g_return_val_if_fail (self, FALSE);

  return mx_button_get_toggled (MX_BUTTON (self->priv->fav_toggle));
}
Beispiel #3
0
static void
mnb_statusbar_update_datetime (MnbStatusbar *self)
{
  MnbStatusbarPrivate *priv = self->priv;
  GDateTime *datetime = g_date_time_new_now_local ();
  gchar *time_str;
  GConfClient *client = gconf_client_get_default ();
  gboolean c24h = gconf_client_get_bool (client, MNB_24H_KEY, NULL);

  if (c24h)
    {

      /* translators: translate this to a suitable 24 hourt time
       * format for your locale showing only hours and minutes. For
       * available format specifiers see
       * http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html
       */
      time_str = g_date_time_format (datetime, _("%A %B %e, %Y - %H:%M"));
    }
  else
    {
      /* translators: translate this to a suitable default time format for
       * your locale showing only hours and minutes. For available format
       * specifiers see
       * http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html
       */
      time_str = g_date_time_format (datetime, _("%A %B %e, %Y - %l:%M %P"));
    }

  mx_button_set_label (MX_BUTTON (priv->datetime), time_str);

  g_date_time_unref (datetime);
  g_free (time_str);
}
static void
mex_queue_button_init (MexQueueButton *self)
{
  ClutterActor *temp_text;

  self->priv = QUEUE_BUTTON_PRIVATE (self);

  self->priv->inner_box = mx_box_layout_new ();
  self->priv->icon = mx_icon_new ();
  self->priv->label = mx_label_new_with_text ("Unknown queue state");
  self->priv->spinner = mx_spinner_new ();
  self->priv->queue_model = mex_queue_model_dup_singleton ();

  g_signal_connect (self->priv->spinner,
                    "looped",
                    (GCallback)_spinner_looped_cb,
                    self);

  clutter_container_add (CLUTTER_CONTAINER (self->priv->inner_box),
                         self->priv->label,
                         self->priv->icon,
                         self->priv->spinner,
                         NULL);

  clutter_container_child_set (CLUTTER_CONTAINER (self->priv->inner_box),
                               self->priv->label,
                               "expand", TRUE,
                               "y-align", MX_ALIGN_MIDDLE,
                               "y-fill", FALSE,
                               NULL);

  clutter_container_child_set (CLUTTER_CONTAINER (self->priv->inner_box),
                               self->priv->icon,
                               "y-align", MX_ALIGN_MIDDLE,
                               "y-fill", FALSE,
                               "x-align", MX_ALIGN_END,
                               NULL);

  clutter_container_child_set (CLUTTER_CONTAINER (self->priv->inner_box),
                               self->priv->spinner,
                               "y-align", MX_ALIGN_MIDDLE,
                               "y-fill", FALSE,
                               "x-align", MX_ALIGN_END,
                               NULL);

  clutter_actor_hide (self->priv->spinner);

  mx_bin_set_child (MX_BIN (self), self->priv->inner_box);
  mx_bin_set_fill (MX_BIN (self), TRUE, FALSE);

  temp_text = mx_label_get_clutter_text (MX_LABEL (self->priv->label));
  clutter_text_set_ellipsize (CLUTTER_TEXT (temp_text), PANGO_ELLIPSIZE_NONE);

  g_signal_connect (self,
                    "notify::toggled",
                    (GCallback)_queue_button_notify_toggled_cb,
                    self);

  mx_button_set_is_toggle (MX_BUTTON (self), TRUE);
}
Beispiel #5
0
static void
mx_button_get_preferred_height (ClutterActor *actor,
                                gfloat        for_width,
                                gfloat       *min_height,
                                gfloat       *pref_height)
{
  MxButtonPrivate *priv = MX_BUTTON (actor)->priv;

  if (priv->content_image)
    {
      gfloat height;

      clutter_actor_get_preferred_height (priv->content_image, for_width,
                                          NULL, &height);
      if (min_height)
        *min_height = height;
      if (pref_height)
        *pref_height = height;

      return;
    }

  CLUTTER_ACTOR_CLASS (mx_button_parent_class)->get_preferred_height (actor,
                                                                      for_width,
                                                                      min_height,
                                                                      pref_height);
}
Beispiel #6
0
static gboolean
mx_button_leave (ClutterActor         *actor,
                 ClutterCrossingEvent *event)
{
  MxButton *button = MX_BUTTON (actor);
  MxWidget *widget = MX_WIDGET (actor);

  if (event->source != actor)
    return FALSE;

  /* hide the tooltip */
  if (mx_widget_get_tooltip_text (widget))
    mx_widget_hide_tooltip (widget);

  /* check if the widget is disabled */
  if (mx_widget_get_disabled (MX_WIDGET (actor)))
    return FALSE;

  if (button->priv->is_pressed)
    {
      //clutter_ungrab_pointer ();

      mx_widget_long_press_cancel (widget);
      mx_stylable_style_pseudo_class_remove (MX_STYLABLE (widget), "active");
      button->priv->is_pressed = FALSE;
    }

  mx_stylable_style_pseudo_class_remove (MX_STYLABLE (widget), "hover");

  return FALSE;
}
Beispiel #7
0
/**
 * mx_menu_add_action:
 * @menu: A #MxMenu
 * @action: A #MxAction
 *
 * Append @action to @menu.
 *
 */
void
mx_menu_add_action (MxMenu   *menu,
                    MxAction *action)
{
    MxMenuChild child;
    ClutterActor *button_child;

    g_return_if_fail (MX_IS_MENU (menu));
    g_return_if_fail (MX_IS_ACTION (action));

    MxMenuPrivate *priv = menu->priv;

    child.action = g_object_ref_sink (action);
    /* TODO: Connect to notify signals in case action properties change */
    child.box = g_object_new (MX_TYPE_BUTTON,
                              "action", child.action,
                              NULL);
    mx_button_set_action (MX_BUTTON (child.box), child.action);

    /* align to the left */
    button_child = clutter_actor_get_child_at_index ((ClutterActor*) child.box, 0);
    clutter_actor_set_x_align (button_child, CLUTTER_ACTOR_ALIGN_START);


    g_signal_connect (child.box, "clicked",
                      G_CALLBACK (mx_menu_button_clicked_cb), action);
    g_signal_connect (child.box, "enter-event",
                      G_CALLBACK (mx_menu_button_enter_event_cb), menu);
    clutter_actor_add_child (CLUTTER_ACTOR (menu), CLUTTER_ACTOR (child.box));

    g_array_append_val (priv->children, child);

    clutter_actor_queue_relayout (CLUTTER_ACTOR (menu));
}
Beispiel #8
0
/**
 * mpl_entry_get_label:
 * @self: #MplEntry
 *
 * Retrieves the text of the entry prompt.
 *
 * Return value: pointer to string holding the label; the string is owned by
 * the entry and must not be freed.
 */
const gchar *
mpl_entry_get_label (MplEntry *self)
{
  g_return_val_if_fail (MPL_IS_ENTRY (self), NULL);

  return mx_button_get_label (MX_BUTTON (self->priv->search_button));
}
Beispiel #9
0
static void
mx_button_get_preferred_width (ClutterActor *actor,
                               gfloat        for_height,
                               gfloat       *min_width,
                               gfloat       *pref_width)
{
  MxButtonPrivate *priv = MX_BUTTON (actor)->priv;

  if (priv->content_image)
    {
      gfloat width;

      clutter_actor_get_preferred_width (priv->content_image, for_height,
                                         NULL, &width);
      if (min_width)
        *min_width = width;
      if (pref_width)
        *pref_width = width;

      return;
    }

  CLUTTER_ACTOR_CLASS (mx_button_parent_class)->get_preferred_width (actor,
                                                                     for_height,
                                                                     min_width,
                                                                     pref_width);
}
Beispiel #10
0
/**
 * mpl_entry_set_label:
 * @self: #MplEntry
 * @label: text of the entry propmpt
 *
 * Sets the text of the entry prompt.
 */
void
mpl_entry_set_label (MplEntry     *self,
                     const gchar  *label)
{
  g_return_if_fail (self);

  mx_button_set_label (MX_BUTTON (self->priv->search_button), label);
}
void
mnb_launcher_button_set_favorite (MnbLauncherButton *self,
                                  gboolean           is_favorite)
{
  g_return_if_fail (self);

  mx_button_set_toggled (MX_BUTTON (self->priv->fav_toggle), is_favorite);
}
static void
mex_action_button_init (MexActionButton *self)
{
    self->priv = ACTION_BUTTON_PRIVATE (self);

    mx_button_set_icon_position (MX_BUTTON (self), MX_POSITION_RIGHT);

    mx_bin_set_fill (MX_BIN (self), TRUE, TRUE);
}
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);
}
Beispiel #14
0
static void
mx_button_paint (ClutterActor *actor)
{
  MxButtonPrivate *priv = MX_BUTTON (actor)->priv;

  if (priv->content_image)
    clutter_actor_paint (priv->content_image);
  else
    CLUTTER_ACTOR_CLASS (mx_button_parent_class)->paint (actor);
}
Beispiel #15
0
static void
mx_button_finalize (GObject *gobject)
{
  MxButtonPrivate *priv = MX_BUTTON (gobject)->priv;

  g_free (priv->text);
  g_free (priv->icon_name);
  g_free (priv->style_icon_name);

  G_OBJECT_CLASS (mx_button_parent_class)->finalize (gobject);
}
Beispiel #16
0
static void
mx_button_get_property (GObject    *gobject,
                        guint       prop_id,
                        GValue     *value,
                        GParamSpec *pspec)
{
  MxButtonPrivate *priv = MX_BUTTON (gobject)->priv;

  switch (prop_id)
    {
    case PROP_LABEL:
      g_value_set_string (value, priv->text);
      break;

    case PROP_ICON_NAME:
      g_value_set_string (value, priv->icon_name ?
                          priv->icon_name : priv->style_icon_name);
      break;

    case PROP_ICON_SIZE:
      g_value_set_uint (value, priv->icon_size ?
                        priv->icon_size : priv->style_icon_size);
      break;

    case PROP_IS_TOGGLE:
      g_value_set_boolean (value, priv->is_toggle);
      break;

    case PROP_TOGGLED:
      g_value_set_boolean (value, priv->is_toggled);
      break;

    case PROP_ACTION:
      g_value_set_object (value, priv->action);
      break;

    case PROP_ICON_POSITION:
      g_value_set_enum (value, priv->icon_position);
      break;

    case PROP_ICON_VISIBLE:
      g_value_set_boolean (value, priv->icon_visible);
      break;

    case PROP_LABEL_VISIBLE:
      g_value_set_boolean (value, priv->label_visible);
      break;

    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
      break;
    }
}
static void
mex_queue_button_update (MexQueueButton *button)
{
  MexQueueButtonPrivate *priv = button->priv;
  if (mex_content_get_metadata (priv->content, MEX_CONTENT_METADATA_QUEUED))
    {
      mx_label_set_text (MX_LABEL (priv->label),
                         _("Remove from queue"));

      g_signal_handlers_block_by_func (button,
                                       _queue_button_notify_toggled_cb,
                                       button);
      mx_button_set_toggled (MX_BUTTON (button), TRUE);
      g_signal_handlers_unblock_by_func (button,
                                         _queue_button_notify_toggled_cb,
                                        button);
    } else {
      mx_label_set_text (MX_LABEL (priv->label),
                         _("Add to queue"));

      g_signal_handlers_block_by_func (button,
                                       _queue_button_notify_toggled_cb,
                                       button);
      mx_button_set_toggled (MX_BUTTON (button), FALSE);
      g_signal_handlers_unblock_by_func (button,
                                         _queue_button_notify_toggled_cb,
                                         button);
    }

  if (mx_spinner_get_animating (MX_SPINNER (button->priv->spinner)))
    {
      mx_label_set_text (MX_LABEL (button->priv->label),
                                   _("Adding to queue"));
      clutter_actor_hide (button->priv->icon);
      clutter_actor_show (button->priv->spinner);
    } else {
      clutter_actor_hide (button->priv->spinner);
      clutter_actor_show (button->priv->icon);
  }
}
Beispiel #18
0
static void
mx_button_set_property (GObject      *gobject,
                        guint         prop_id,
                        const GValue *value,
                        GParamSpec   *pspec)
{
  MxButton *button = MX_BUTTON (gobject);

  switch (prop_id)
    {
    case PROP_LABEL:
      mx_button_set_label (button, g_value_get_string (value));
      break;

    case PROP_ICON_NAME:
      mx_button_set_icon_name (button, g_value_get_string (value));
      break;

    case PROP_ICON_SIZE:
      mx_button_set_icon_size (button, g_value_get_uint (value));
      break;

    case PROP_IS_TOGGLE:
      mx_button_set_is_toggle (button, g_value_get_boolean (value));
      break;

    case PROP_TOGGLED:
      mx_button_set_toggled (button, g_value_get_boolean (value));
      break;

    case PROP_ACTION:
      mx_button_set_action (button, g_value_get_object (value));
      break;

    case PROP_ICON_POSITION:
      mx_button_set_icon_position (button, g_value_get_enum (value));
      break;

    case PROP_ICON_VISIBLE:
      mx_button_set_icon_visible (button, g_value_get_boolean (value));
      break;

    case PROP_LABEL_VISIBLE:
      mx_button_set_label_visible (button, g_value_get_boolean (value));
      break;

    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
      break;
    }
}
static void
mex_music_player_set_context (MexContentView *player,
                              MexModel       *model)
{
  MexMusicPlayerPrivate *priv = MEX_MUSIC_PLAYER (player)->priv;
  ClutterActor *box, *button;
  MexContent *content;
  gint i;

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

  priv->model = model;

  if (model)
    g_object_ref (model);

  box = mex_script_get_actor (priv->script, "tracks");
  clutter_actor_remove_all_children (box);

  for (i = 0; (content = mex_model_get_content (model, i)); i++)
    {
      const gchar *title;

      title = mex_content_get_metadata (content, MEX_CONTENT_METADATA_TITLE);
      button = mx_button_new_with_label (title);
      mx_stylable_set_style_class (MX_STYLABLE (button), "Track");
      mx_button_set_is_toggle (MX_BUTTON (button), TRUE);
      g_object_set_data (G_OBJECT (button), "content", content);
      g_signal_connect (button, "clicked",
                        G_CALLBACK (mex_music_player_item_clicked), player);

      mx_button_set_icon_position (MX_BUTTON (button), MX_POSITION_RIGHT);

      clutter_actor_add_child (box, button);
    }
}
static void
dawati_bt_request_update_strings (DawatiBtRequest *request)
{
  DawatiBtRequestPrivate *priv = GET_PRIVATE (request);
  const char *name = NULL;
  char *msg = NULL;
  const char *yes = "";

  switch (priv->request) {
    case DAWATI_BT_REQUEST_TYPE_AUTH:
      if (priv->request_data) {
        name = g_hash_table_lookup (priv->uuid_strings, priv->request_data);
        if (name) {
          /* TRANSLATORS: request message. Will appear just below a device name */
          msg = g_strdup_printf (_("Wants access to %s service"), name);
        } else {
          g_debug ("Unrecognised service '%s' requested", priv->request_data);
          /* TRANSLATORS: request message. Will appear just below a device name */
          msg = g_strdup (_("wants access to a service"));
        }
      /* TRANSLATORS: request button label */
        yes = _("Grant this time");
      }
      break;
    case DAWATI_BT_REQUEST_TYPE_PIN:
    case DAWATI_BT_REQUEST_TYPE_PASSKEY:
      /* TRANSLATORS: request message. Will appear just below a device name */
      msg = g_strdup (_("Wants to pair with this computer. "
                        "Please enter the PIN mentioned on the device"));
      /* TRANSLATORS: request button label */
      yes = _("OK");
      break;
    case DAWATI_BT_REQUEST_TYPE_CONFIRM:
      /* TRANSLATORS: request message. Will appear just below a device name */
      msg = g_strdup_printf (_("Wants to pair with this computer. "
                               "Please confirm whether the PIN '%s' matches the one on the device"),
                             priv->request_data);
      /* TRANSLATORS: request button label */
      yes = _("Matches");
      break;
    default:
      break;
  }

  mx_label_set_text (MX_LABEL (priv->request_label), msg);
  mx_button_set_label (MX_BUTTON (priv->request_yes_btn), yes);

  g_free (msg);
}
/* content view */
static void
mex_music_player_set_content (MexContentView *player,
                              MexContent     *content)
{
  MexMusicPlayerPrivate *priv = MEX_MUSIC_PLAYER (player)->priv;
  gchar *album_artist;
  const gchar *uri, *album, *artist, *title;
  ClutterActorIter iter;
  ClutterActor *child, *container;

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

  priv->content = content;

  if (!content)
    return;

  g_object_ref (content);


  /* title */
  title = mex_content_get_metadata (content, MEX_CONTENT_METADATA_TITLE);
  mx_label_set_text (MX_LABEL (priv->title_label), title);


  /* subtitle (album, artist) */
  album = mex_content_get_metadata (content, MEX_CONTENT_METADATA_ALBUM);
  artist = mex_content_get_metadata (content, MEX_CONTENT_METADATA_ARTIST);
  album_artist = g_strconcat (album, ", ", artist , NULL);
  mx_label_set_text (MX_LABEL (priv->subtitle_label), album_artist);
  g_free (album_artist);

  /* uri */
  uri = mex_content_get_metadata (content, MEX_CONTENT_METADATA_STREAM);
  clutter_media_set_uri (priv->player, uri);

  /* find the item in the list */
  container = mex_script_get_actor (priv->script, "tracks");
  clutter_actor_iter_init (&iter, container);
  while (clutter_actor_iter_next (&iter, &child))
    {
      MexContent *button_content;

      button_content = g_object_get_data (G_OBJECT (child), "content");

      mx_button_set_toggled (MX_BUTTON (child), (button_content == content));
    }
}
Beispiel #22
0
static gboolean
mx_button_key_release (ClutterActor    *actor,
                       ClutterKeyEvent *event)
{
  if (event->keyval == CLUTTER_KEY_Return ||
      event->keyval == CLUTTER_KEY_KP_Enter ||
      event->keyval == CLUTTER_KEY_ISO_Enter ||
      event->keyval == CLUTTER_KEY_space)
    {
      mx_button_pull (MX_BUTTON (actor));

      return TRUE;
    }

  return FALSE;
}
Beispiel #23
0
static gboolean
mx_button_button_release (ClutterActor       *actor,
                          ClutterButtonEvent *event)
{
  if (mx_widget_get_disabled (MX_WIDGET (actor)))
    return TRUE;

  if (event->button == 1)
    {
      mx_button_pull (MX_BUTTON (actor));

      return TRUE;
    }

  return TRUE;
}
static void
ntf_wm_update_notification (NtfNotification *ntf, MetaWindow *window)
{
  ClutterActor *src_icon;
  ClutterActor *button;
  NtfSource    *src;
  const gchar  *title;
  const gchar  *summary;
  const gchar  *body;

  g_return_if_fail (ntf && window);

  src = ntf_notification_get_source (ntf);

  if ((src_icon = ntf_source_get_icon (src)))
    {
      ClutterActor *icon = clutter_clone_new (src_icon) ;

      ntf_notification_set_icon (ntf, icon);
    }

  title = meta_window_get_title (window);

  if (title)
    summary = title;
  else
    summary = _("Unknown window");

  ntf_notification_set_summary (ntf, summary);

  body = _("is asking for your attention.");

  ntf_notification_set_body (ntf, body);

  ntf_notification_remove_all_buttons (ntf);

  button = mx_button_new ();

  mx_button_set_label (MX_BUTTON (button), _("Activate"));

  g_signal_connect (button, "clicked",
                    G_CALLBACK (ntf_wm_activate_cb),
                    window);

  ntf_notification_add_button (ntf, button, 0);
}
Beispiel #25
0
static void
mx_button_dispose (GObject *gobject)
{
  MxButtonPrivate *priv = MX_BUTTON (gobject)->priv;

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

  if (priv->content_image)
    {
      clutter_actor_remove_child (CLUTTER_ACTOR (gobject), priv->content_image);
      priv->content_image = NULL;
    }

  G_OBJECT_CLASS (mx_button_parent_class)->dispose (gobject);
}
static void
ntf_tray_constructed (GObject *object)
{
  NtfTray        *self = (NtfTray*) object;
  ClutterActor   *actor = (ClutterActor*) self;
  NtfTrayPrivate *priv = self->priv;
  ClutterActor   *button;

  if (G_OBJECT_CLASS (ntf_tray_parent_class)->constructed)
    G_OBJECT_CLASS (ntf_tray_parent_class)->constructed (object);

  priv->notifiers = clutter_actor_new ();

  clutter_actor_add_child(actor, priv->notifiers);
  /* 'Overflow' control */
  priv->control = mx_table_new ();

  mx_stylable_set_style_class (MX_STYLABLE (priv->control),
                               "notification-control");
#if 0
  button = mx_button_new ();
  mx_button_set_label (MX_BUTTON (button), _("Dismiss All"));
  mx_table_add_actor (MX_TABLE (priv->control), button, 0, 1);

  g_signal_connect (button, "clicked",
                    G_CALLBACK (ntf_tray_dismiss_all_cb), self);
#endif //DV
  priv->control_text = mx_label_new ();
  mx_table_add_actor (MX_TABLE (priv->control),
                        CLUTTER_ACTOR (priv->control_text), 0, 0);

  clutter_actor_set_width (priv->control, CLUSTER_WIDTH);

  clutter_actor_add_child(actor, priv->control);

  clutter_actor_hide (priv->control);

  clutter_actor_set_reactive (priv->notifiers, TRUE);
  clutter_actor_set_reactive (actor, TRUE);

  mnb_input_manager_push_actor (actor, MNB_INPUT_LAYER_TOP);
}
static void
mex_action_button_init (MexActionButton *self)
{
  ClutterColor shadow_color = {0, 0, 0, 64};
  MexActionButtonPrivate *priv;

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

  mx_button_set_icon_position (MX_BUTTON (self), MX_POSITION_RIGHT);

  mx_bin_set_fill (MX_BIN (self), TRUE, TRUE);

  priv->shadow = mex_shadow_new ();
  mex_shadow_set_radius_x (priv->shadow, 15);
  mex_shadow_set_radius_y (priv->shadow, 15);
  mex_shadow_set_color (priv->shadow, &shadow_color);
  clutter_actor_meta_set_enabled (CLUTTER_ACTOR_META (priv->shadow), FALSE);
  clutter_actor_add_effect (CLUTTER_ACTOR (self),
                            CLUTTER_EFFECT (priv->shadow));
}
static ClutterActor *
create_controls (RBShell *shell)
{
    RBShellPlayer *player;
    ClutterActor *box;
    ClutterActor *button;
    int pos;
    gboolean playing;

    g_object_get (shell, "shell-player", &player, NULL);

    box = mx_box_layout_new ();
    mx_box_layout_set_orientation (MX_BOX_LAYOUT (box), MX_ORIENTATION_HORIZONTAL);
    mx_box_layout_set_spacing (MX_BOX_LAYOUT (box), 16);
    mx_stylable_set_style_class (MX_STYLABLE (box), "ControlsBox");
    mx_stylable_set_style (MX_STYLABLE (box), style);
    clutter_actor_set_reactive (box, TRUE);

    /* XXX rtl? */
    pos = 0;
    button = create_button ("PrevButton", "PrevButtonIcon", "media-skip-backward");
    g_signal_connect_object (button, "clicked", G_CALLBACK (prev_clicked_cb), player, 0);
    mx_box_layout_add_actor (MX_BOX_LAYOUT (box), button, pos++);

    button = create_button ("PlayPauseButton", "PlayPauseButtonIcon", "media-playback-start");
    g_signal_connect_object (button, "clicked", G_CALLBACK (playpause_clicked_cb), player, 0);
    g_signal_connect_object (player, "playing-changed", G_CALLBACK (playing_changed_cb), button, 0);
    g_object_get (player, "playing", &playing, NULL);
    update_playing (MX_BUTTON (button), playing);
    mx_box_layout_add_actor (MX_BOX_LAYOUT (box), button, pos++);

    button = create_button ("NextButton", "NextButtonIcon", "media-skip-forward");
    g_signal_connect_object (button, "clicked", G_CALLBACK (next_clicked_cb), player, 0);
    mx_box_layout_add_actor (MX_BOX_LAYOUT (box), button, pos++);

    g_object_unref (player);
    return box;
}
Beispiel #29
0
static void
mx_button_allocate (ClutterActor           *actor,
                    const ClutterActorBox  *box,
                    ClutterAllocationFlags  flags)
{
  MxButtonPrivate *priv = MX_BUTTON (actor)->priv;

  CLUTTER_ACTOR_CLASS (mx_button_parent_class)->allocate (actor, box, flags);

  if (priv->content_image)
    {
      ClutterActorBox childbox;

      childbox.x1 = 0;
      childbox.y1 = 0;
      childbox.x2 = (box->x2 - box->x1);
      childbox.y2 = (box->y2 - box->y1);

      clutter_actor_allocate (priv->content_image, &childbox, flags);
    }

  mx_bin_allocate_child (MX_BIN (actor), box, flags);
}
static void
mex_telepathy_channel_set_camera_state (MexTelepathyChannel *self, gboolean on)
{
  MexTelepathyChannelPrivate *priv = self->priv;
  MxAction *action = mx_button_get_action (
    MX_BUTTON (self->priv->camera_button));

  if (on)
    {
      clutter_actor_show (priv->video_outgoing);
      // We are starting, so change the button to pause.
      mx_stylable_set_style_class (MX_STYLABLE (
                                     priv->camera_button), "CameraOff");
      mx_action_set_display_name (action, "Camera Off");
    }
  else
    {
      clutter_actor_hide (priv->video_outgoing);
      // We are stopping, so change the button to play.
      mx_stylable_set_style_class (MX_STYLABLE (
                                     priv->camera_button), "CameraOn");
      mx_action_set_display_name (action, "Camera On");
    }
}