コード例 #1
0
void i_configure_ev_bok( GtkWidget * button_ok , gpointer configwin )
{
  DEBUGMSG( "saving configuration...\n" );
  i_configure_cfg_ap_save(); /* save amidiplug settings */
  i_configure_cfg_backend_save(); /* save backend settings */
  DEBUGMSG( "configuration saved\n" );

  /* check if a different backend has been selected */
  if (( backend.name == NULL ) || ( strcmp( amidiplug_cfg_ap.ap_seq_backend , backend.name ) ))
  {
    DEBUGMSG( "a new backend has been selected, unloading previous and loading the new one\n" );
    i_backend_unload(); /* unload previous backend */
    i_backend_load( amidiplug_cfg_ap.ap_seq_backend ); /* load new backend */
  }
  else /* same backend, just reload updated configuration */
  {
    if ( backend.gmodule != NULL )
    {
      DEBUGMSG( "the selected backend is already loaded, so just perform backend cleanup and reinit\n" );
      backend.cleanup();
      backend.init( i_configure_cfg_get_file );
    }
  }

  if ( GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(button_ok),"bapply_pressed")) == 1 )
  {
    g_object_set_data( G_OBJECT(button_ok) , "bapply_pressed" , GUINT_TO_POINTER(0) );
  }
  else
  {
    i_configure_cfg_backend_free(); /* free backend settings */
    gtk_widget_destroy(GTK_WIDGET(configwin));
  }
}
コード例 #2
0
static void i_configure_commit (GtkWidget * configwin)
{
  DEBUGMSG( "saving configuration...\n" );
  i_configure_cfg_ap_save(); /* save amidiplug settings */
  i_configure_cfg_backend_save(); /* save backend settings */
  DEBUGMSG( "configuration saved\n" );

  /* check if a different backend has been selected */
  if (( backend.name == NULL ) || ( strcmp( amidiplug_cfg_ap.ap_seq_backend , backend.name ) ))
  {
    DEBUGMSG( "a new backend has been selected, unloading previous and loading the new one\n" );
    i_backend_unload(); /* unload previous backend */
    i_backend_load( amidiplug_cfg_ap.ap_seq_backend ); /* load new backend */
  }
  else /* same backend, just reload updated configuration */
  {
    if ( backend.gmodule != NULL )
    {
      DEBUGMSG( "the selected backend is already loaded, so just perform backend cleanup and reinit\n" );
      backend.cleanup();
      backend.init( i_configure_cfg_get_file );
    }
  }

  i_configure_cfg_backend_free ();
  gtk_widget_destroy (configwin);
}