Ejemplo n.º 1
0
static void
mex_music_player_shuffle_toggled (MexMusicPlayer *player,
                                  GParamSpec     *spec,
                                  MxButton       *button)
{
  MexMusicPlayerPrivate *priv = player->priv;
  gint i;

  if (mx_button_get_toggled (button))
    {
      gint length;

      length = mex_model_get_length (priv->model);

      priv->shuffle = g_array_sized_new (FALSE, FALSE, sizeof (gint), length);

      for (i = 0; i < length; i++)
        g_array_insert_val (priv->shuffle, i, i);

      /* shuffle the list */
      g_array_sort (priv->shuffle, mex_music_player_random_sort);
    }
  else
    {
      if (priv->shuffle)
        {
          g_array_free (priv->shuffle, TRUE);
          priv->shuffle = NULL;
        }
    }
}
Ejemplo n.º 2
0
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));
}
Ejemplo n.º 3
0
static void
mex_music_player_repeat_toggled (MexMusicPlayer *player,
                                 GParamSpec     *pspec,
                                 MxButton       *repeat_button)
{
  MexMusicPlayerPrivate *priv = player->priv;

  priv->repeat = mx_button_get_toggled (repeat_button);
}
Ejemplo n.º 4
0
static void
button_toggled_notify_cb (MxButton      *button,
                          GParamSpec    *pspec,
                          MxButtonGroup *group)
{
  if (mx_button_get_toggled (button))
    mx_button_group_set_active_button (group, button);
  else
    mx_button_group_set_active_button (group, NULL);
}
Ejemplo n.º 5
0
static void
hour_clock_changed (ClutterActor *button, MnpWorldClock *world_clock)
{
    /*	MnpWorldClockPrivate *priv = GET_PRIVATE (world_clock); */
    gboolean tfh;
    GConfClient *client = gconf_client_get_default();

    tfh = mx_button_get_toggled ((MxButton *)button);

    gconf_client_set_bool (client, "/apps/date-time-panel/24_h_clock", tfh, NULL);
    g_object_unref(client);
}
Ejemplo n.º 6
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);
    }
}
Ejemplo n.º 7
0
static void
_queue_button_notify_toggled_cb (MxButton       *button,
                                 GParamSpec     *pspec,
                                 MexQueueButton *q_button)
{
  MexQueueButtonPrivate *priv = q_button->priv;
  const gchar *mimetype;

  gboolean directory;

  mimetype = mex_content_get_metadata (priv->content,
                                       MEX_CONTENT_METADATA_MIMETYPE);
  directory = !g_strcmp0 (mimetype, "x-grl/box")
    || !g_strcmp0 (mimetype, "x-mex/group");

  /* Triggers a train of actions that makes content have it's queued
   * property set which then runs the notify cb which calls
   * mex_queue_button_update so we don't need to run it directly
   */

  if (mx_button_get_toggled (button))
    {
      mex_queue_button_set_animated (q_button, TRUE);

      if (directory)
        _add_from_directory (q_button, TRUE);
      else
        mex_model_add_content (priv->queue_model, priv->content);
    }
  else
    {
      mex_queue_button_set_animated (q_button, FALSE);

      if (directory)
          _add_from_directory (q_button, FALSE);
      else
        mex_model_remove_content (priv->queue_model, priv->content);
    }
}