Esempio n. 1
0
static void
mex_queue_plugin_init (MexQueuePlugin *self)
{
  MexQueuePluginPrivate *priv = GET_PRIVATE (self);
  MexActionInfo *action_info;
  MexModelInfo *model_info;
  MexModel *queue_model;

  queue_model = mex_queue_model_dup_singleton ();

  g_object_set (queue_model, "icon-name", "icon-panelheader-queue", NULL);

  /*
   * Attention! Fake action .. this then causes MexContentBox to put an
   * MexQueueButton in its place
   */
  action_info = g_new0 (MexActionInfo, 1);
  action_info->action = mx_action_new_full ("enqueue",
                                            _("Add to queue"),
                                            NULL,
                                            self);
  action_info->mime_types = g_strdupv ((gchar **)all_data_mimetypes);
  action_info->priority = 100;

  priv->actions = g_list_append (priv->actions, action_info);

  model_info = mex_model_info_new (queue_model, "queue", 0, NULL);

  priv->models = g_list_append (priv->models, model_info);
}
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);
}
Esempio n. 3
0
static void
mex_clear_queue_cb (MxAction *action,
                    MexModel *model)
{
  MexModel *model_from_proxy;
  model_from_proxy = mex_queue_model_dup_singleton ();

  mex_model_clear (model_from_proxy);
  g_object_unref (model_from_proxy);
}