Exemplo n.º 1
0
static void _lib_modulegroups_toggle(GtkWidget *button, gpointer user_data)
{
  dt_lib_module_t *self = (dt_lib_module_t *)user_data;
  dt_lib_modulegroups_t *d = (dt_lib_modulegroups_t *)self->data;

  /* block all button callbacks */
  for (int k = 0; k < DT_MODULEGROUP_SIZE; k++)
    g_signal_handlers_block_matched (d->buttons[k], G_SIGNAL_MATCH_FUNC, 0, 0, NULL, _lib_modulegroups_toggle, NULL);

  /* deactivate all buttons */
  uint32_t cb = 0;
  for (int k = 0; k < DT_MODULEGROUP_SIZE; k++)
  {
    /* store toggled modulegroup */
    if(d->buttons[k] == button) cb=k;
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(d->buttons[k]), FALSE);
  }


  if (d->current == cb)
    d->current = DT_MODULEGROUP_NONE;
  else
  {
    d->current = cb;
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(d->buttons[cb]), TRUE);
  }

  /* unblock all button callbacks */
  for (int k = 0; k < DT_MODULEGROUP_SIZE; k++)
    g_signal_handlers_unblock_matched (d->buttons[k], G_SIGNAL_MATCH_FUNC, 0, 0, NULL, _lib_modulegroups_toggle, NULL);

  /* update visibility */
  _lib_modulegroups_update_iop_visibility(self);

}
Exemplo n.º 2
0
static void _lib_modulegroups_set(dt_lib_module_t *self, uint32_t group)
{
  dt_lib_modulegroups_t *d = (dt_lib_modulegroups_t *)self->data;

  /* this is a proxy function so it might be called from another thread */
  gboolean i_own_lock = dt_control_gdk_lock();

  /* if no change just update visibility */
  if(d->current == group)
  {
    _lib_modulegroups_update_iop_visibility(self);
    return;
  }

  /* set current group */
  if(group < DT_MODULEGROUP_SIZE && GTK_IS_TOGGLE_BUTTON(d->buttons[group]))
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(d->buttons[group]), TRUE);

  if(i_own_lock) dt_control_gdk_unlock();
}